【发布时间】:2014-01-27 23:38:42
【问题描述】:
我正在尝试使用 Yii 框架让 Selenium Web Driver 与 php 一起工作。
phpunit 已安装并正在运行。
我正在运行最新版本的 selenium 服务器。 (selenium-server-standalone-2.37.0.jar)
我有this Yii extension for web driver installed。
我有这个 shell 测试。
Yii::import('ext.webdriver-bindings.CWebDriverDbTestCase');
class SiteTest extends CWebDriverDbTestCase
{
public function testExample() {
$this->get("http://www.example.com");
$this->assertTrue($this->isTextPresent('Example Domain'));
$this->assertTrue(true);
}
}
当我使用
在命令行上运行它时phpunit functional/SiteTest.php
测试运行。将打开一个带有空配置文件的 Firefox 窗口(安装了 Web 驱动程序插件)。但网页无法加载。地址栏中没有任何内容。什么都没有发生。浏览器保持打开状态,同时命令行打印以下内容。
PHPUnit 3.7.28 by Sebastian Bergmann.
Configuration read from C:\full\path\to\yii\project\protected\tests\phpunit.xml
F
Time: 4.88 seconds, Memory: 3.50Mb
There was 1 failure:
1) SiteTest::testExample
Failed asserting that false is true.
C:\full\path\to\yii\project\protected\tests\functional\SiteTest.php:18
FAILURES!
Tests: 1, Assertions: 1, Failures: 1.
我使用的是 Windows 7,并已尝试关闭防火墙以查看是否是原因。
正如您所见,随着第二次测试通过,phpunit 工作正常。但由于某种原因,firefox 没有打开请求的页面。
编辑:我使用的是最新版本的 php (5.5.5)
编辑:我现在也尝试使用 Chrome 驱动程序。我得到相同的结果。 Chrome 会打开,但无法加载页面。地址栏只有“data:,”。
【问题讨论】:
标签: php yii selenium-webdriver