PHPUnit Selenium2 - 无浏览器实例

标签 phpunit selenium-webdriver

当我运行一个示例测试时,无论是在 Netbeans IDE 中还是从命令行运行,例如:

class WebTest extends PHPUnit_Extensions_Selenium2TestCase
{
protected function setUp()
{
    $this->setBrowser('firefox');
    $this->setBrowserUrl('http://www.example.com/');
}

public function testTitle()
{
    $this->url('http://www.example.com/');
    $this->assertEquals('Example WWW Page', $this->title());
}

}

我收到了 PHPUnit 响应,但它似乎没有与 Selenium 服务器通信,因为没有创建浏览器窗口。

PHPUnit 3.6.10 by Sebastian Bergmann.

Configuration read from /var/www/gcd/framework/yii/gadget/protected/tests/phpunit.xml

F

Time: 1 second, Memory: 10.50Mb

There was 1 failure:

1) WebTest::testTitle
Failed asserting that null matches expected 'Example WWW Page'.

使用 PHPUnit 3.6.10 和 selenium-server-standalone-2.21.0

有人有什么想法吗?

最佳答案

事实证明,如果您使用 sudo 运行 PHPUnit,它就可以工作!哦!

关于PHPUnit Selenium2 - 无浏览器实例,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10622277/

相关文章:

php - 断言对象值在 PHPUnit 中的范围内

java - Selenium 网络驱动程序 :To enter an element into ul li text box

python - 此版本的 ChromeDriver 仅支持 Chrome 版本 79 - Python

java - 将 @FindBy 与我自己的类一起使用,而不是与 WebElement 一起使用

c# - 使用 Selenium WebDriver 从 IWebElement 获取所有属性

PHPUnit 数据提供程序参数计数错误

php - 如何在运行 PHPUnit 的 NetBeans 上修复 "unrecognized option --run"

php - 为什么代码覆盖率报告在 php 7.2 上失败?

php - Selenium /PHPUnit : End a session when re-using browser sessions?

java - 无法对 webdrivermanger 使用 git 个人访问 token ?