Error while closing Webdriver with Google Chrome

4,399 views
Skip to first unread message

Web User

unread,
Apr 11, 2012, 7:58:41 PM4/11/12
to webd...@googlegroups.com
Platform Using  win 7 , Maven , Test NG and web driver 2.20 with chrome .

After my tests are running i am trying to give these command to close the chrome and web driver instance.


After webDriver = new ChromeDriver();

i am calling this and
    @AfterClass
    public void tearDown()  {
           
        webDriver.quit();
        webDriver.close();


And i am getting this error.

AILED CONFIGURATION: @AfterClass tearDown
org.openqa.selenium.remote.UnreachableBrowserException: Error communicating with the remote browser. It may have died.
Build info: version: '2.20.0', revision: '16008', time: '2012-02-28 15:00:40'
System info: os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.7.0_03'
Driver info: driver.version: RemoteWebDriver
    at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:435)
    at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:442)
    at org.openqa.selenium.remote.RemoteWebDriver.close(RemoteWebDriver.java:313)
    at com.proferi.uitests.AppTest.tearDown(AppTest.java:78)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:80)
    at org.testng.internal.Invoker.invokeConfigurationMethod(Invoker.java:551)
    at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:213)
    at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:138)
    at org.testng.internal.TestMethodWorker.invokeAfterClassMethods(TestMethodWorker.java:225)
    at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:114)
    at org.testng.TestRunner.privateRun(TestRunner.java:768)
    at org.testng.TestRunner.run(TestRunner.java:617)
    at org.testng.SuiteRunner.runTest(SuiteRunner.java:334)
    at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:329)
    at org.testng.SuiteRunner.privateRun(SuiteRunner.java:291)
    at org.testng.SuiteRunner.run(SuiteRunner.java:240)
    at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:53)
    at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:87)
    at org.testng.TestNG.runSuitesSequentially(TestNG.java:1185)
    at org.testng.TestNG.runSuitesLocally(TestNG.java:1110)
    at org.testng.TestNG.run(TestNG.java:1022)
    at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:109)
    at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:202)
    at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:173)
Caused by: org.openqa.selenium.WebDriverException: Session ID may not be null
Build info: version: '2.20.0', revision: '16008', time: '2012-02-28 15:00:40'
System info: os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.7.0_03'
Driver info: driver.version: RemoteWebDriver
    at org.openqa.selenium.remote.HttpCommandExecutor$CommandInfo.get(HttpCommandExecutor.java:545)
    at org.openqa.selenium.remote.HttpCommandExecutor$CommandInfo.getMethod(HttpCommandExecutor.java:529)
    at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:268)
    at org.openqa.selenium.chrome.ChromeCommandExecutor.execute(ChromeCommandExecutor.java:50)
    at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:415)
    ... 27 more


Please help .

Thanks
Adity
    }


Krishnan Mahadevan

unread,
Apr 12, 2012, 3:37:34 AM4/12/12
to webd...@googlegroups.com
Only webDriver.quit() is required if you want to clean up all the browsers.

webDriver.close() closes off the browser, but since in this case it occurs after quit() call, you see this error.

Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"






--
You received this message because you are subscribed to the Google Groups "webdriver" group.
To view this discussion on the web visit https://groups.google.com/d/msg/webdriver/-/OYcyM2VfEOMJ.
To post to this group, send email to webd...@googlegroups.com.
To unsubscribe from this group, send email to webdriver+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/webdriver?hl=en.

Selenium User

unread,
Apr 13, 2012, 8:20:44 PM4/13/12
to webd...@googlegroups.com
Hi, 

Close()
              Close the current window, quitting the browser if it's the last window currently open. 

quit()
              Quits this driver, closing every associated window. 

In the above code you are quitting and closing.
So, after closing associated window, you are trying to close it again. 
So that it is showing this error. 

Thanks 

Starter.


seluser

unread,
Jul 16, 2012, 5:32:28 PM7/16/12
to webd...@googlegroups.com

Hello,

I have a similar problem only with chrome driver. When I use driver.quit or driver.close it says "Error communicating with the remote browser. It may have died."
But when I look at http://localhost:4444/grid/console using close() does not release the instance but quit() releases it. Either ways it throws the exception alone. (Both driver and session are not null either)

if(browser.equals("chrome")) {
                       
                        driver.quit() or driver.close();
                       
                    }
What could be the reason. An d which should I actually be using?
Thanks,
Harini
To unsubscribe from this group, send email to webdriver+unsubscribe@googlegroups.com.

Mike Riley

unread,
Jul 16, 2012, 5:49:23 PM7/16/12
to webd...@googlegroups.com
I just noticed that Chrome has updated recently (version 20) and there is a new version of CrhomeDriver.exe available.  I was seeing an error when my test quit as well, but upgrading chromedriver.exe to the latest version fixed it.

Mike

atc

unread,
Sep 13, 2012, 12:37:56 AM9/13/12
to webd...@googlegroups.com
To unsubscribe from this group, send email to webdriver+...@googlegroups.com.

atc

unread,
Sep 13, 2012, 12:45:50 AM9/13/12
to webd...@googlegroups.com
Hi Mike,

  I am seeing the issue that is posted in this forum almost 50% of the time when I run the tests on chrome. I do have the latest chrome browser installed and am relying on the latest chromedriver(23.0.1240.0) for MAC. 
  I have a  grid set-up, there is one hub and 2 nodes hooked to hub. When I kick off tests, most of the time only one of the node is picked and as I didn't configure for parallel execution of tests, for each tests, it kicks off one chrome browser and closes it.

  I did set-up -browserTimeout as 90sec on hub and the left the default -timeout option that is configured for 30sec.

  Based on some suggestion that I noticed for this issue, I did comment out driver.close() and just had driver.quit(). But even this didn't help.

  Any suggestions on what exactly is meant by "Session ID may not be null"?
 
  Thanks in advance.

Mike Riley

unread,
Sep 13, 2012, 1:03:20 PM9/13/12
to webd...@googlegroups.com
It means that the session ID value you are passing is null.  Somehow you didn't pass a valid value.

Mike

Krishnan Mahadevan

unread,
Sep 13, 2012, 1:26:11 PM9/13/12
to webd...@googlegroups.com
I dont think session id is something that you would pass but instead it is something that gets created at the selenium end. AFAIK sessionId is the selenium's way of associating a user's session with a browser instance. Atleast that is my understanding with my limited explorations with the RemoteWebDriver. 
To view this discussion on the web visit https://groups.google.com/d/msg/webdriver/-/ak4HH5dNQ3oJ.

To post to this group, send email to webd...@googlegroups.com.
To unsubscribe from this group, send email to webdriver+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/webdriver?hl=en.


--
Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"
My Scribblings @ http://wakened-cognition.blogspot.com/

Mike Riley

unread,
Sep 13, 2012, 6:47:37 PM9/13/12
to webd...@googlegroups.com
I believe you are correct, but don't have a system set up here that I can verify it with right now.  What I meant was that the session ID is somehow null that is being used.

I think I had this happen one time when I did a quit() and then tried to reuse the RemoteWebDriver object or some such thing.

Mike
To unsubscribe from this group, send email to webdriver+unsubscribe@googlegroups.com.

For more options, visit this group at http://groups.google.com/group/webdriver?hl=en.

Mark Collin

unread,
Sep 15, 2012, 3:14:58 PM9/15/12
to webd...@googlegroups.com

If your session ID is null your selenium/webdriver object has already been destroyed by something.  Sounds like you are either closing the last window (which will perform a quit) before doing a quit, or you have a quit being called somewhere else.

To view this discussion on the web visit https://groups.google.com/d/msg/webdriver/-/oXLM0OoEpS4J.

vivek T

unread,
Oct 6, 2012, 2:32:34 PM10/6/12
to webd...@googlegroups.com
Can the session id become null even when the browser is open for that session?
I am seeing these exception in chrome driver while taking a selenium webdriver screenshot. 

Thanks
Vivek
Reply all
Reply to author
Forward
0 new messages