Selenium/PHPUnit:重新使用浏览器会话时结束会话? [英] Selenium/PHPUnit: End a session when re-using browser sessions?
问题描述
我正在使用PHPUnit进行Selenium测试.
I'm runnig Selenium tests with PHPUnit.
我将一些较长的测试序列分成几个测试文件,以使其更易于维护. 为了提高速度,我想在这些情况下重新使用浏览器会话.
I have some long test sequences split into several test files to make them easier to maintain. For higher speed I would like to re-use the browser session for these cases.
我能够重用会话(PHPUnit_Extensions_SeleniumTestCase :: shareSession(true)),但是我无法弄清楚如何结束会话并在开始下一个测试之前需要打开一个新会话(这需要一个新的浏览器会话).
I am able to reuse the sessions (PHPUnit_Extensions_SeleniumTestCase::shareSession(true)), but I cannot figure out how to end the session and open a new one before starting the next tests (which require a fresh browser session).
我已经尝试在测试的tearDown()方法中使用以下行来终止当前的浏览器会话
I have tried using the following line in the tearDown() method of the test to kill the current browser session
$this->stop();
这会杀死浏览器,但会生成错误:会话xxxxxx不存在或已结束"
this kills the browser, but generates an error: "Session xxxxxx does not exist or was ended"
=>确实如此,但是在这种情况下,如何让Selenium开始新的会话?
=> Exactly, but how do I get Selenium to start a new session in this case?
感谢任何线索.
推荐答案
尝试添加
-browserSessionReuse
-browserSessionReuse
启动Selenium RC节点时的参数.
parameter when launching an Selenium RC node.
这篇关于Selenium/PHPUnit:重新使用浏览器会话时结束会话?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!