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.
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.