2010-11-18 38 views
7

我使用PHP运行Selenium RC。 我运行一个简单的登录测试,即成功完成,但只是在关闭浏览器之前,我得到以下错误:Selenium + PHPUnit:sessionId不应该为null;这个会议已经开始了吗?

23:50:09.969 INFO - Command request: testComplete[, ] on session d7a1effeabc24b0b9b46ad6fdb3eebec 23:50:09.969 INFO - Killing Google Chrome... 23:50:10.286 INFO - Got result: OK on session d7a1effeabc24b0b9b46ad6fdb3eebec 23:50:10.349 INFO - Command request: getLocation[, ] on session null 23:50:10.351 ERROR - Exception running 'getLocation 'command on session null java.lang.NullPointerException: sessionId should not be null; has this session been started yet? at org.openqa.selenium.server.FrameGroupCommandQueueSet.getQueueSet(FrameGroupCommandQueueSet.java:216) at org.openqa.selenium.server.commands.SeleniumCoreCommand.execute(SeleniumCoreCommand.java:34) at org.openqa.selenium.server.SeleniumDriverResourceHandler.doCommand(SeleniumDriverResourceHandler.java:562) at org.openqa.selenium.server.SeleniumDriverResourceHandler.handleCommandRequest(SeleniumDriverResourceHandler.java:370) at org.openqa.selenium.server.SeleniumDriverResourceHandler.handle(SeleniumDriverResourceHandler.java:129) at org.openqa.jetty.http.HttpContext.handle(HttpContext.java:1530) at org.openqa.jetty.http.HttpContext.handle(HttpContext.java:1482) at org.openqa.jetty.http.HttpServer.service(HttpServer.java:909) at org.openqa.jetty.http.HttpConnection.service(HttpConnection.java:820) at org.openqa.jetty.http.HttpConnection.handleNext(HttpConnection.java:986) at org.openqa.jetty.http.HttpConnection.handle(HttpConnection.java:837) at org.openqa.jetty.http.SocketListener.handleConnection(SocketListener.java:245) at org.openqa.jetty.util.ThreadedServer.handle(ThreadedServer.java:357) at org.openqa.jetty.util.ThreadPool$PoolThread.run(ThreadPool.java:534) 23:50:10.364 INFO - Got result: ERROR Server Exception: sessionId should not be null; has this session been started yet? on session null

我无法找到一个解决办法... 请帮助。

+0

看起来像你杀了谷歌浏览器的getLocation前右()。也许要确保getLocation()调用在testComplete()之前。 – yonran 2010-11-19 07:30:29

+1

谢谢。看来在tearDown中添加stop()会导致它失败。 – Shimix 2010-11-19 08:39:19

+0

@yonran - 你应该把它作为答案。 @Shimix,你应该接受他的回答。 – 2011-06-15 17:55:19

回答

0

问题出在tearDown()之内的stop()呼叫。删除它解决了问题。

0

添加在setUp()这些行帮助:

$this->start(); 
sleep(1); 
相关问题