Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting session not found errors in Selenium 2 for certain browsers

I'm sorry if this question is vague, but I have a set of Selenium WebDriver tests, and they are currently not working in Chrome or IE. For whatever reason Firefox works fine.

The error is very similar for both Chrome and IE, and it is perplexing because I know for sure that the Chrome tests have worked before.

(And yes, I do have chromedriver in the path and it is opening the browser).

Basically what happens is that the tests will run partway through and are even able to interact with the page.

Eventually, though, they all fail with this error:

     org.openqa.selenium.WebDriverException: 

     session 2fca1234-343f-45e7-af49-6486b13e1eba does not exist

I was just wondering if anyone else has seen this error or anything similar.

I have looked around quite a bit and haven't found anyone having the same issue.

For the record, I am running my tests in Java and using Selenium 2.5

like image 858
Brian T. Avatar asked Sep 01 '11 16:09

Brian T.


People also ask

What is session not found exception?

Hence SessionNotFoundException WebDriver Exception will occur when driver is trying to perform operations on the Web Application after the Browser is closed or when the Browser Session is not available.

Can we use Selenium to work with an already open browser session?

We can connect to an already open browser using Selenium webdriver. This can be done using the Capabilities and ChromeOptions classes. The Capabilities class obtains the browser capabilities with the help of the getCapabilities method.

What is IllegalStateException Selenium?

An IllegalStateException is a runtime exception in Java that is thrown to indicate that a method has been invoked at the wrong time. This exception is used to signal that a method is called at an illegal or inappropriate time.


Video Answer


1 Answers

I've been seeing the Session not found error in my Chrome automation. By examining the logs from these failures, I've determined that the error occurs because the DELETE session command is sent twice at the end of the test. The first DELETE actually deletes the session, so the second DELETE has no session to talk to.

I haven't dug into the Selenium WebDriver code enough to figure out why DELETE session is sent twice.

like image 160
Scott Babcock Avatar answered Oct 27 '22 20:10

Scott Babcock