Sometimes Chrome Driver doesn't gets closed properly

156 views
Skip to first unread message

shrirang vaze

unread,
Sep 1, 2015, 2:20:11 AM9/1/15
to Selenium Users

Hi All,

I have a test suite of over 300 tests. When I run all tests at one go, 30% of tests fail because Chrome driver sometimes doesn't gets closed at the end of test which makes the subsequent tests to fail.

The test errors out at the beginning with error trace below. The following errors occurs because the driver object was not launched and it can't find the object reference of WebDriver.

Error trace given below
ExceptionHandler function threw exception
System.NullReferenceException: Object reference not set to an instance of an object.

The same test suite runs well on FF and Safari on Mac.

Is there any issue filed for this with Selenium HQ?

Or Is there any workaround /solution to this?

Shawn McCarthy

unread,
Sep 1, 2015, 10:15:53 AM9/1/15
to Selenium Users
Give every test their own WebDriver instance? This way if one fails to close, it won't affect the other tests. You would just end up with some leftover browser windows that failed to close. However, you might want to look into why the browser window isn't closing always.

anemuday

unread,
Sep 1, 2015, 2:09:45 PM9/1/15
to Selenium Users
I am hoping you are using driver.close();

rather try with driver.quit();

For a better understanding watch this video to find the difference between driver.close and driver.quit.
Difference b/w Driver.close and Driver.quit in Selenium WebDriver

Thanks,
Uday
Free Selenium WebDriver Videos
Reply all
Reply to author
Forward
0 new messages