0

I have a set of Selenium WebDriver test that are failing randomly and I want to rerun only those test that fail immediately say try it for 3 times. I run the tests on grid with multiple browsers which I guess is causing the issue. I followed the solution given here in How to Re-run failed JUnit tests immediately? But whenever it tries to run a failed test we get this exception

Error Message

org.openqa.selenium.remote.SessionNotFoundException: Session ID is null
Build info: version: '2.32.0', revision: '6c40c18', time: '2013-04-09 17:23:22'
System info: os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.6.0_26'
Driver info: driver.version: RemoteWebDriver
Stacktrace

java.lang.RuntimeException: org.openqa.selenium.remote.SessionNotFoundException: Session ID is null
Build info: version: '2.32.0', revision: '6c40c18', time: '2013-04-09 17:23:22'
System info: os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.6.0_26'
Driver info: driver.version: RemoteWebDriver
    at au.com.cgu.harvest.automation.rule.AbstractWebDriverManager.classFinished(AbstractWebDriverManager.java:77)
    at au.com.cgu.harvest.automation.rule.ClassFinishRule.finished(ClassFinishRule.java:48)
    at au.com.cgu.harvest.automation.scenario.RetryTest$1.evaluate(RetryTest.java:41)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
    at java.util.concurrent.FutureTask.run(FutureTask.java:138)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
    at java.lang.Thread.run(Thread.java:662)
Caused by: org.openqa.selenium.remote.SessionNotFoundException: Session ID is null
Build info: version: '2.32.0', revision: '6c40c18', time: '2013-04-09 17:23:22'
System info: os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.6.0_26'
Driver info: driver.version: RemoteWebDriver
    at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:273)
    at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:527)
    at org.openqa.selenium.remote.RemoteWebDriver.executeScript(RemoteWebDriver.java:463)
    at au.com.cgu.harvest.automation.rule.AbstractWebDriverManager.classFinished(AbstractWebDriverManager.java:65)

`

Community
  • 1
  • 1
Maalamaal
  • 963
  • 3
  • 11
  • 23

1 Answers1

0

While my situation was slightly different I encountered the same error message. Are you using the WebDrive close() method in you code? I was able to fix the issue by using the WebDriver quit() method.

from the javadocs:http://selenium.googlecode.com/svn/trunk/docs/api/java/index.html

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

close()

//Quits this driver, closing every associated window.

quit()