Selenium RC throws sessionsid should not be null exception, phpunit 3.4 bug only?

Posted by user342775 on Stack Overflow See other posts from Stack Overflow or by user342775
Published on 2010-05-17T05:57:18Z Indexed on 2010/05/17 6:00 UTC
Read the original article Hit count: 387

Filed under:
|
|
|

I am looking to migrate my selenium RC tests to using PHPUnit 3.4.12 from PHPUnit 3.3.2

The selenium test will fail with an exception of the following when I use assertTextPresent() PHPUnit_Framework_Exception: Response from Selenium RC server for getLocation(). ERROR Server Exception: sessionId should not be null; has this session been started yet?.

For example:

public function testSending($browser)
{
   ...
   $browser->click("send");
   $browser->waitForPageToLoad("30000");
   $browser->assertTextPresent("text");                
}

Below is the selenium RC log (running on Windows):

15:40:19.676 INFO - Command request: isTextPresent[text, ] on session 153d03a123c42098711994f43c2db34
15:40:19.691 INFO - Got result: OK,false on session 153d023a123c42098711994f43cdb34
15:40:19.879 INFO - Command request: testComplete[, ] on session 153d023a123c4298711994f43c2db34
15:40:19.879 INFO - Killing Firefox...
15:40:20.269 INFO - Got result: OK on session 153d023a123c42098711994f43c2db34
15:40:20.472 INFO - Command request: getLocation[, ] on session null
15:40:20.472 ERROR - Exception running 'getLocation 'command on session null
java.lang.NullPointerException: sessionId should not be null; has this session been started yet?

As you can see, the test should have completed as indicated by the "Killing Firefox" bit, but it instead continued to do something else and triggered the getLocation[, ] command which caused the exception.

I have tried the same test with PHPUnit 3.3.2 which did not produce this problem - the test would happily end without the getLocation().

Any ideas?

thanks

© Stack Overflow or respective owner

Related posts about phpunit

Related posts about selenium