我需要一些关于selenium-phpunit实现的建议。 我使用selenium RC和phpunit与php-webdriver-bindings连接phpunit和selenium来执行一些自动测试任务。
当我尝试访问iframe中存在的元素时,问题就出现了。正常的getElementBy(LocatorStrategy :: id,'@ requiredelement')不起作用,因为当使用“phpunit filename.php”运行代码时它会产生“NoSuchElementException”。
在java,c#,python中的iframe的实现过程中,有一些实现用于改变我在一些Q& As中看到的内容。不确定这些实现是否适用于php。
我在Ubuntu 12.04上运行phpunit 3.7和include_file“webdriver.php”以及php-webdriver-bindings的相关功能(http://code.google.com/p/php-webdriver-bindings/ )。未检测到iframe中的元素。
答案 0 :(得分:1)
尝试使用:
$this->selectFrame("<xpath to get iframe>>"); // for example: //*[@id='iframe']
$this->assertElementPresent("<xpath to get to element in frame>");
一分钟前就已经开始了 - 它有效=)