java.awt.Robot class does not work in Jenkins job for handling upload dialog window when running Selenium test suite.

2,538 views
Skip to first unread message

Sahil Mutreja

unread,
Nov 22, 2016, 11:33:16 PM11/22/16
to webdriver
I am running a selenium test suite via a Jenkins job, but stuck on a window upload dialog box.
Currently I'm using java.awt.Robot class to handle upload which works fine on local machine.
When the same suite is ran via Jenkins job it fails on window upload dialog and is unable to interact with it.

I have read AutoIt and Sikuli are also 2 other ways to handle window dialogs,
but which approach is best and compatible with Jenkins?

Shawn McCarthy

unread,
Nov 26, 2016, 1:47:50 PM11/26/16
to webdriver
I've used http://codoid.com/robotil/ for remote machines. You need a service running ON the nodes, not where you run the code from.

David

unread,
Nov 27, 2016, 12:53:48 PM11/27/16
to webdriver
As Shawn mentions, whatever option you go with, it needs to be accessed remotely like a service. They are all compatible with Jenkins, because it's not a Jenkins issue but a remote execution issue. Some other options besides what Shawn mentions are:

Language agnostic solutions (via WebDriver API but working similar to Robotil)

For a Selenium grid supported Sikuli (for Java):

Another thing to be aware of is whether your jenkins job executes locally or remotely, and whether it has access to a desktop UI. If it executes locally on the jenkins server where the test code resides, you might not have the issue Shawn mentions. But If no access to a desktop UI, e.g. using xvfb or headless browser mode, that's going to be a problem with handling upload dialogs where a UI is expected. And having a locked desktop could also affect that (desktop UI must be open, not locked, or if in remote desktop session, the session must be active). If you need a UI, I believe you generally don't execute on the Jenkins server but have the job on server execute against a slave that offers a desktop UI, etc. (for better reliability anyways).
Reply all
Reply to author
Forward
0 new messages