2

我需要一些关于 selenium-phpunit 实现的建议。我正在使用 selenium RC 和 phpunit 与 php-webdriver-bindings 连接 phpunit 和 selenium 以执行一些自动化测试任务。

当我尝试访问 iframe 中存在的元素时,问题就来了。正常的 getElementBy(LocatorStrategy::id,'@requiredelement') 不起作用,因为它在使用 "phpunit filename.php" 运行代码时会给出 "NoSuchElementException" 。

从我在一些问答中看到的内容来看,有一些实现可以在 java、c#、python 中的 iframe 的实现过程中更改窗口。不确定这些实现是否适用于 php。

我在带有 phpunit 3.7 和 include_file "webdriver.php" 的 Ubuntu 12.04 上运行,它是 php-webdriver-bindings (http://code.google.com/p/php-webdriver-bindings/) 的相关函数。未检测到 iframe 中的元素。

4

1 回答 1

1

尝试使用它:

$this->selectFrame("<xpath to get iframe>>"); // for example: //*[@id='iframe']
$this->assertElementPresent("<xpath to get to element in frame>"); 

一分钟前已经破解了-它有效=)

于 2012-10-11T14:53:30.950 回答