2

I am setting up a headless Ubuntu server as a node. This node runs Chrome via Chromedriver, and I am able to run tests when I launch the jar via bash. This is the command I am using:

java -jar /opt/selenium-server-standalone-2.39.0.jar -role node -hub 
http://qwautomation02:4444/grid/register -port 5555 
-Dwebdriver.chrome.driver=/opt/chromedriver.exe -nodeConfig /mnt/smb/Configuration/nodeConfig.json

I have written a Java application to run this command and insert the ports that are being used into a database. This application uses the same bash command to start the Selenium server as above. I am launching this jar from the /opt directory, the same directory that the Selenium server jar is in. Here is the applicable method:

    public static Process startupNode(int portNumber, String browser) throws IOException{
    //If Linux, else Windows.
    String port = String.valueOf(portNumber);
    if (Portability.isUnix()) {
        return Runtime.getRuntime().exec(String.format("java -jar /opt/selenium-server-standalone-2.39.0.jar -role node -hub http://qwautomation02:4444/grid/register -port %s -Dwebdriver.chrome.driver=/opt/chromedriver -nodeConfig /mnt/smb/Configuration/nodeConfig.json"
                , port));   
    }
    else
        return Runtime.getRuntime().exec(String.format("java -jar C:\\Selenium\\vendor\\selenium-server-standalone-2.39.0.jar -role node -hub http://qwautomation02:4444/grid/register -port %s -Dwebdriver.chrome.driver=C:\\Chromedriver\\chromedriver.exe -nodeConfig \\\\qwautomation02\\WebDriver\\Configuration\\nodeConfig.json"
                , port));   
}

I can start a test and part of runs, but this exception is always thrown during execution and cannot be caught.

Exception being thrown

It appears that the session is losing communication with the hub in mid execution. But, considering the test will run to completion when I manually run the bash command, I am at a loss for why this is occurring.

Andrew
  • 815
  • 2
  • 13
  • 33
  • Try adding some wait hust before the line of Exception. From https://groups.google.com/forum/?fromgroups=#!topic/selenium-users/1im-LurjK5s – me_digvijay Mar 04 '14 at 20:01

1 Answers1

1

This sounds like an Ubuntu permissions error. Your personal Ubuntu user has execute access, but the user / process that is running the java file may not.

Apollo Clark
  • 806
  • 9
  • 16
  • http://stackoverflow.com/questions/14015829/how-to-supply-sudo-with-root-password-from-java I'm going to try implementing the answer from here. The actual jar executes, though. It just has communication issues with the other server. I wasn't sure if it could be an issue with getRuntime().exec on the same thread as the main thread that has a ReadLine() statement to keep the jar running. – Andrew Mar 04 '14 at 18:53
  • It also could be a polling timeout with the hub. I've run into that with more complex element selectors. – Apollo Clark Mar 04 '14 at 20:45
  • Could you elaborate on this? – Andrew Mar 04 '14 at 20:47
  • Sure, I'd love to. The Selenium Webdriver Grid / Hub mode, when run in parallel will sometimes lockup while waiting for callbacks from each node. My setup is an Ubuntu Host running 3 VM Images of various configs of Windows and IE. The selenium hub runs in Ubuntu, and the nodes run in Windows. – Apollo Clark Mar 04 '14 at 21:19
  • Optimization advice: http://blogs.telerik.com/automated-testing-tools/posts/07-07-16/selenium-ie-performance-issues-tests-optimization – Apollo Clark Mar 04 '14 at 21:23