Hello,
Recently I've started to work with selenium grid and chromedriver. As an example I've started with 1 hub and one node which is configured to work with one browser only.
I use the latest available version of selenium (2.50.0) and version 2.21 of chromedriver
Here are the definitions of hub:
java -jar selenium-server-standalone-2.50.0.jar -debug -role hub
And Here are the definitions of node:
java -jar selenium-server-standalone-2.50.0.jar -debug -role node -hub
http://localhost:4444/grid/register -port 5555 -browser browserName=chrome, maxInstances=1, maxSession=1 platform=Linux -Dwebdriver.chrome.driver=/tmp/selenium/chromedriver2_21/chromedriver
I'm running on Oracle jvm 1.8.0_72 on Linux Redhat 6.3 (64 bit) VM.
Now I run test client on my windows machine with the code like this:
...
public static void main(String[] args) throws MalformedURLException {
for(int i = 0; i < 10000; i++) {
System.out.print("[ " + new Date() + "] running test #: " + i);
runSingleTest();
}
}
...
public static void runSingleTest() throws MalformedURLException {
ChromeOptions options = new ChromeOptions();
options.addArguments(Arrays.asList("--window-size=800,600"));
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setPlatform(Platform.LINUX);
capabilities.setBrowserName("chrome");
RemoteWebDriver driver = new RemoteWebDriver(new URL("http://<MY_HUB_HOST_GOES_HERE>:4444/wd/hub"),capabilities);
driver.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS);
driver.manage().timeouts().pageLoadTimeout(30, TimeUnit.SECONDS);
driver.manage().window().setSize(new Dimension(800, 600));
try {
// Find the text input element by its name
WebElement element = driver.findElement(By.name("q"));
// Enter something to search for
element.sendKeys("Cheese!");
// Now submit the form. WebDriver will find the form for us from the element
element.submit();
}catch(Throwable t) {
// I just want to see it:
System.err.println(t);
}
finally {
driver.close();
}
}
When I run it, I see that eventually (usually after 30-35 tests) chrome is not shown anymore on node machine and the test gets stuck. A this point there are 2 chrome processes at this point (not a renderer and no zygota processes). I don't see any kind of errrors/exceptions in logs of hub or node.
So, I conclude that sometimes chrome gets stuck unless I do something wrong in my setup.
But, maybe someone can point me on my mistake? What am I doing wrong?
Thanks in advance,
Mark