PHPUnit_Framework_Exception:当我使用Hudson运行时无法连接到Selenium RC服务器 [英] PHPUnit_Framework_Exception: Could not connect to the Selenium RC server when I run with Hudson
问题描述
我设置了Hudson CI服务器并使用Selenium运行PHPUnit测试(非常感谢此帖!)。
现在我在我的localhost上运行Hudson服务器和Selenium服务器。
我将Hudson设置为端口8080(默认),Selenium -port 1234会冲突。
I have set up Hudson CI Server and running PHPUnit test with Selenium (big thanks to this post!). Now I am running Hudson server and Selenium server on my localhost. I set up Hudson as port 8080 (default) and Selenium -port 1234 as it conflicts otherwise.
但是,每次运行Selenium测试,以下错误:
However, every time I run Selenium test, I get a following error:
PHPUnit_Framework_Exception:无法连接到Selenium RC服务器。
PHPUnit_Framework_Exception: Could not connect to the Selenium RC server.
/ Users / * /。hudson / jobs / Selenium / workspace / sampleTest.php:28
/usr/lib/php/phing.php:37
/Users/*/.hudson/jobs/Selenium/workspace/sampleTest.php:28 /usr/lib/php/phing.php:37
其中第28行是一个断言:
$ this-> assertElementContainsText($ html,this is sample test);
where line 28 is an assertion: $this->assertElementContainsText($html, "this is sample test");
这里是我的Selenium设置函数:
and here is my Selenium setup function:
function setUp(){
$ this-> setBrowser(* firefox);
$ this-> setHost(localhost);
$ this-> setPort(1234) >
$ this-> setBrowserUrl(example.com);
$ this-> setTimeout(100000); }
function setUp() {
$this->setBrowser("*firefox");
$this->setHost("localhost");
$this->setPort(1234);
$this->setBrowserUrl("example.com");
$this->setTimeout(100000); }
如何避免此错误讯息?
您的建议非常感谢。
how can I avoid this error message? your suggestions are greatly appreciated.
感谢所有,
推荐答案
如果是这样,您需要使用 waitForElement()
删除 waitForPageToload()
函数。我使用selenium IDE为我生成代码。
Are you testing ajax? If so, you need to remove your waitForPageToload()
functions with a waitForElement()
. I used selenium IDE to generate the code for me.
这篇关于PHPUnit_Framework_Exception:当我使用Hudson运行时无法连接到Selenium RC服务器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!