微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

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.

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐