尽管服务器正在运行,PHPUnit仍不断报告Selenium服务器处于非活动状态
我不知道为什么PHPUnit一直说:尽管服务器正在运行,PHPUnit仍不断报告Selenium服务器处于非活动状态,php,selenium,selenium-webdriver,phpunit,selenium-ide,Php,Selenium,Selenium Webdriver,Phpunit,Selenium Ide,我不知道为什么PHPUnit一直说: The Selenium Server is not active on host http://127.0.0.1:4444/wd/hub at port 4444. The Selenium Server is not active on host http://127.0.0.1:4444/wd/hub at port 4444. 我通过以下命令从桌面启动了Selenium服务器: java -jar selenium-server-standal
The Selenium Server is not active on host http://127.0.0.1:4444/wd/hub at port 4444.
The Selenium Server is not active on host http://127.0.0.1:4444/wd/hub at port 4444.
我通过以下命令从桌面启动了Selenium服务器:
java -jar selenium-server-standalone-2.53.0.jar
我得到了这个日志:
有几个司机没有登记。我不知道为什么,但我只是遵循SeleniumHQ网站上非常简短的安装指南
接下来,我开始尝试运行从Selenium IDE生成的PHPUnit测试脚本,并将其导出为PHPUnit\u Extensions\u SeleniumTest2Case
。下面是我的设置代码的外观:
<?php
require __DIR__ . '/vendor/autoload.php';
class Example extends PHPUnit_Extensions_Selenium2TestCase
{
protected function setUp()
{
$this->setHost('http://127.0.0.1:4444/wd/hub');
$this->setPort(4444);
$this->setBrowser("*firefox");
$this->setBrowserUrl("http://localhost/testing");
}
我可以访问http://127.0.0.1:4444/wd/hub
通过我的浏览器,没有问题。所以,我很确定我的Selenium服务器已经在运行了
PHPUnit不断终止,结果如下:
OK, but incomplete, skipped, or risky tests!
Tests: 1, Assertions: 0, Skipped: 1.
要使PHPUnit和Selenium正常工作,我还需要做些什么?setHost()
应该只有主机部分
$this->setHost('127.0.0.1');
除此之外,我建议使用简单的PHPUnit、PageObjects和一个稍微更活跃/维护的WebDriver包装器,因为它将允许您更好地处理/集成作为BrowserStack的跨浏览器测试提供商。但这只是我的观点:)
setHost()
应该只有主机部分
$this->setHost('127.0.0.1');
除此之外,我建议使用简单的PHPUnit、PageObjects和一个稍微更活跃/维护的WebDriver包装器,因为它将允许您更好地处理/集成作为BrowserStack的跨浏览器测试提供商。但这只是我的观点:)这里只是一个猜测,但是
setHost
让我觉得您应该只传递一个主机名,即this->setHost('127.0.0.1')
,甚至放弃主机、端口等,因为它们可能可以使用默认设置,这些都是默认设置~我有同样的问题。我在ubuntu上将selenium 3与PHP5.5.9一起使用。您还可以在phpunit运行时添加--verbose,以获取更多信息。这里只是猜测一下,但是setHost
让我认为您应该只传递一个主机名,即this->setHost('127.0.0.1')
或者甚至放弃主机、端口等,因为它们可能对defaultsYup没问题,这些是默认设置~我也有同样的问题。我在ubuntu上使用selenium 3和PHP5.5.9。您还可以在phpunit运行中添加--verbose,以获取更多信息。我尝试在setHost()中仅使用主机部分,但仍然会遇到相同的错误。很抱歉,我的意思是,setHost
应该只有IP,您还需要setPort
,其他我知道您的意思。我试过了,但还是不行。我实际上输入了该路径,因为localhost:4444在通过浏览器访问时实际上给了我一个403错误。但是我可以用wd/hub/path通过浏览器访问它。最好的办法是查看在phpunit selenium master/phpunit/Extensions/Selenium2TestCase.php:298
上抛出的确切错误(print\r?)是什么。我也有同样的问题,我没有使用它。我尝试过只使用setHost()中的主机部分,但仍然会遇到同样的错误。很抱歉,我的意思是,setHost
应该只有IP,您还需要setPort
,其他我知道您的意思。我试过了,但还是不行。我实际上输入了该路径,因为localhost:4444在通过浏览器访问时实际上给了我一个403错误。但是我可以用wd/hub/path通过浏览器访问它。最好的办法是查看在phpunit selenium master/phpunit/Extensions/Selenium2TestCase.php:298
上抛出的确切错误(print\r?)是什么。我也有同样的问题,我不使用它。