我使用的是Selenium 2.34.0+phpunit,它无法识别我的"代码"。我使用$this->url('blqblq'),错误是它无法识别命令url。你们也有同样的问题吗?当我"恢复"到2.33时,测试工作非常完美:)。我的phpunit版本是3.7.21,phpunit_Selenium是最新的1.3.1。非常感谢。我的"代码"是
<?php
//require_once 'setupfile.php';
class testtestest extends PHPUnit_Extensions_Selenium2TestCase //extends setupfile
{
public function setUp()
{
$this->setBrowser('firefox');
$this->setBrowserUrl('http://www.stackoverflow.com');
}
public function testexample()
{
$this->url('http://www.stackoverflow.com');
$this->assertEquals('Example WWW Page', $this->title());
}
}
?>
硒2.34.0的调试日志文件位于此处->http://fikata.ivo.so/test234.txt
编辑2:)
我在phpunit_selenium和var_dump($info)中访问了Responce.php;然后在:1) 2.34 vardump返回此:
PHPUnit 3.7.21 by Sebastian Bergmann.
Earray(26) {
'url' =>
string(36) "http://127.0.0.1:4444/wd/hub/session"
'content_type' =>
string(30) "application/json;charset=UTF-8"
'http_code' =>
int(200)........
2) 2.33 vardump返回此:
PHPUnit 3.7.21 by Sebastian Bergmann.
Farray(26) {
'url' =>
string(73) "http://127.0.0.1:4444/wd/hub/session/66aacaaa-6690-46a4-9d1b-5f75b
3d48d53"
'content_type' =>
string(30) "application/json;charset=UTF-8"
'http_code' =>
int(200)
'header_size' =>
int(536).........
显然,区别在于会话id,那么为什么2.34没有呢?请给我建议,谢谢。
这是Selenium服务器的BC中断。PHPUnit绑定现在已经更新为与所有版本的服务器兼容:
https://github.com/sebastianbergmann/phpunit-selenium/pull/266
升级到master分支(或下一个版本,当可用时将是1.3.2)以获得修复。
我不确定您正在为php-webdriver使用哪个库。从你的代码中,我猜要么是Adam Goucher/Element-34 php网络驱动程序,要么是Facebook php网络驱动的旧版本。
WebDriver二进制文件的会话处理似乎发生了一些变化,这些变化还没有反映在element-34的WebDriver绑定中。在我使用这些绑定的地方,我已经能够修补绑定,使其正常工作(这个pull请求看起来像是在纠正问题:https://github.com/Element-34/php-webdriver/pull/44)。
如果你使用的是Facebook绑定,它们最近已经被完全重写了。不幸的是,这可能意味着您的测试在更新之前都已损坏。新的脸书版本与WebDriver 2.34在这里为我工作。请在此处查看新绑定:https://github.com/facebook/php-webdriver