执行脚本一段时间后,"无法连接到Selenium RC服务器"

far*_*mka 12 php selenium phpunit selenium-rc

我的测试课中有一个测试用例,并且有一些问题.我从控制台运行脚本.该脚本执行到某一点,然后测试失败,出现错误:

Could not connect to the Selenium RC server.

这是来自控制台的日志:

PHPUnit 3.5.15 by Sebastian Bergmann.

E

Time: 01:56, Memory: 4.00Mb

There was 1 error:

1) someTest::testSomething
PHPUnit_Framework_Exception: Could not connect to the Selenium RC server.

/var/www/path.../someTest.php:105

FAILURES!
Tests: 1, Assertions: 0, Errors: 1.

我的测试脚本中的第105行:

$this->clickAndWait("//a[text()='Next']");

这是Selenium日志:

14:00:40.983 INFO - Command request: click[//a[text()='Next'], ] on session 4222e17607254f41a6a52e13d0fd7cc5
14:00:41.205 INFO - Got result: OK on session 4222e17607254f41a6a52e13d0fd7cc5
14:00:41.207 INFO - Command request: waitForPageToLoad[600000000, ] on session 4222e17607254f41a6a52e13d0fd7cc5
14:02:11.328 INFO - Command request: testComplete[, ] on session 4222e17607254f41a6a52e13d0fd7cc5
14:02:11.328 INFO - Killing Firefox...
14:02:11.506 INFO - Got result: ERROR: Got a null result on session 4222e17607254f41a6a52e13d0fd7cc5
14:02:11.508 INFO - Got result: OK on session

我尝试使用Selenium Server Standalone 2.19.0,然后使用2.20.0 - 结果相同.

即使在测试中断后,服务器仍在运行.

我的问题是: 为什么这个错误突然发生并意外地中断了脚本?


PHPUnit 3.5.15
Selenium Server Standalone 2.19.0和2.20.0
Firefox 3.6.18
Ubuntu 10.04

Raj*_*Roy 1

尝试使用 $this->click("link=Next"); 这背后的原因是,当 selenium 尝试查找文本并且页面未完全加载或存在不明确的文本时,selenium 会抛出它并显示“无法连接到 Selenium RC 服务器”。文本的验证/断言有时会产生问题。