user2001495
user2001495

Reputation: 31

TimeOut issue and stale instances of webdriver after test fails

I am testing a web application using Webdriver, more or less as decribed below. When the tests pass, everything is fine. However, I noticed the below 2 issues when one of the test fails.

a)If one test fails, then the rest of the tests in the suite will timeout without closing the Webdriver instance. So there will be some stale instances of webdriver remaining on the node machine.

b)When one of the tests fail with timeout issue all the remaining tests in that class(as testng is configured to run classes in parallel) fail with the below exception org.openqa.selenium.remote.UnreachableBrowserException Error communicating with the remote browser. It may have died.

How can we fix both these issues, could this be an issue with the Grid? Any suggestions will be great. Below are more details about the grid configuration and the environment details.

Browser and version:- Chrome and version is 23.0.1271.101

Selenium version:- 2.28.0

Grid hub and node properties:-

Hub start :- java -jar /tools/grid/selenium-server-standalone-2.28.0.jar -role hub -maxSession 20 -browserTimeout 240 -remoteControlPollingIntervalInSeconds 180 -sessionMaxIdleTimeInSeconds 240 -newSessionMaxWaitTimeInSeconds 250 -timeout 30

Node start:- java -jar /tools/grid/selenium-server-standalone-2.28.0.jar -role node -Dwebdriver.chrome.driver=/ChromeDriver/23.0.1240/chromedriver –hub http://mobygrid.dev.ebay.com:4444/grid/register

Testng.xml which runs class in parallel with 5 threads:-

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<!--  <suite name="Single Group Suite"> -->
<suite name="Single Group Suite" parallel="classes" thread-count="5">
<test name="Single Group Test Run" preserve-order="false">
<groups>
    <define name="completetests">
              <include name="ViewItem"/>
              <include name="ViewItem2"/>
              <include name="ViewItem3"/>
            </define>
               <run>
<include name="@GROUP@" />
<include name="init" />
<exclude name="noRun" />
</run>
</groups>
<classes>
<class name="com.tabletweb.test.tests.ViewItemPageTests" /> 
                                        <class name="com.tabletweb.test.tests.ViewItemPageTests2" /> 
                                        <class name="com.tabletweb.test.tests.ViewItemPageTests3" /> 
</classes>
</test>
</suite>

Thanks!

Upvotes: 3

Views: 11387

Answers (1)

Sergio Pelin
Sergio Pelin

Reputation: 874

Have a look at the tips for running with grid: your problem sounds like the one described there. Revising timouts configuration might help too.

We run tests in parallel with the same versions of grid and ChromeDriver and get no errors.

Upvotes: 2

Related Questions