php – 无法使用多个方法参数调用命令

每次我尝试使用一个基本的 PHPUnit Selenium断言时,测试都会出错并显示以下消息:
Exception: You cannot call a command with multiple method arguments.

http://phpunit.de/manual/3.7/en/selenium.html,它显示使用情况:

void assertElementValueEquals(string $locator,string $text)

当我打电话给它时

$this->assertElementValueEquals( 'id=date_1_formatted','2013-01-01' );

每次测试都会产生上述错误,即使这种格式似乎适用于其他问题,例如问题Using PHPUnit with Selenium,how can I test that an element contains exactly something?

selenium2TestCase中未实现assertElementValueEquals.在你的链接上它提到了SeleniumTestCase(Selenium RC版本).

此外,你使用了正确的结构与$this-> byXPath,就像这里https://github.com/sebastianbergmann/phpunit-selenium/blob/master/Tests/Selenium2TestCaseTest.php

您也可以使用$this-> byId():

$element = $this->byId('date_1_formatted');
$this->assertEquals('2013-01-01',$element->value());

P. S.:如果您熟悉Selenium IDE,可以试试这个command line tool.

相关文章

统一支付是JSAPI/NATIVE/APP各种支付场景下生成支付订单,返...
统一支付是JSAPI/NATIVE/APP各种支付场景下生成支付订单,返...
前言 之前做了微信登录,所以总结一下微信授权登录并获取用户...
FastAdmin是我第一个接触的后台管理系统框架。FastAdmin是一...
之前公司需要一个内部的通讯软件,就叫我做一个。通讯软件嘛...
统一支付是JSAPI/NATIVE/APP各种支付场景下生成支付订单,返...