【发布时间】:2017-09-05 11:04:19
【问题描述】:
我正在尝试为 Web 应用程序设置测试 - 我在 Docker 和 PHPUnit 5.7.19 中有带 VNC 的 Selenium 独立 3.2 服务器。
不过一行
$this->webDriver->findElement(WebDriverBy::xpath($main_button_xpath))->click();
有时会抛出(但有时不会)不应该的异常 - 我已经通过 VNC 观看了它,目标按钮被看到并出现在屏幕上,但它仍然抛出异常。自从我从 2.57 升级 Selenium 服务器后,这些错误开始出现。
您知道如何更好地修复或调试它吗?
非常感谢
编辑:例外
The element reference is stale. Either the element is no longer attached to the DOM or the page has been refreshed.
For documentation on this error, please visit: http://seleniumhq.org/exceptions/stale_element_reference.html
Build info: version: '3.2.0', revision: '8c03df6', time: '2017-03-02 09:34:51 -0800'
System info: host: 'dbcbaf52ae71', ip: '172.17.0.3', os.name: 'Linux', os.arch: 'amd64', os.version: '3.10.0-514.10.2.el7.x86_64', java.version: '1.8.0_121'
Driver info: org.openqa.selenium.firefox.FirefoxDriver
Capabilities [{moz:profile=/tmp/rust_mozprofile.JUP1ydgC8zCR, rotatable=false, timeouts={implicit=0, page load=300000, script=30000}, pageLoadStrategy=normal, platform=ANY, specificationLevel=0, moz:accessibilityChecks=false, acceptInsecureCerts=false, browserVersion=52.0, platformVersion=3.10.0-514.10.2.el7.x86_64, moz:processID=17210, browserName=firefox, platformName=linux}]
Session ID: 47bf2157-c7a8-47ea-a82a-3ab3ddd0ee61
【问题讨论】:
-
您有实际异常消息和堆栈跟踪的示例吗?
-
@segFault 添加了异常
标签: php selenium exception phpunit