我不明白这怎么可能。错误有时会消失,但大多数情况下它是实际的。Selenium 日志显示以下内容:
Element not found with xpath, //html
Unable to locate element: {"method":"xpath","selector":"//html"}
Command duration or timeout: 1.24 seconds
For documentation on this error, please visit: http://seleniumhq.org/exceptions/no_such_element.html
Build info: version: '2.32.0', revision: '6c40c18', time: '2013-04-09 17:22:56'
System info: os.name: 'Linux', os.arch: 'i386', os.version: '2.6.32-5-686', java.version: '1.7.0_11'
Session ID: cbfc080e-f4a9-4ec9-aa72-3a8adeb0e9b9
Driver info: org.openqa.selenium.firefox.FirefoxDriver
Capabilities [{platform=LINUX, databaseEnabled=true, cssSelectorsEnabled=true, javascriptEnabled=true, acceptSslCerts=true, handlesAlerts=true, browserName=firefox, browserConnectionEnabled=true, nativeEvents=false, webStorageEnabled=true, rotatable=false, locationContextEnabled=true, applicationCacheEnabled=true, takesScreenshot=true, version=17.0}] [] []
提前感谢您的帮助!
更新 我发现这个问题只对以下版本的 Selenium 服务器是实际的:
selenium-server-standalone-2.31.0.jar
selenium-server-standalone-2.32.0.jar
selenium-server-standalone-2.28.0.jar 适用于此类 XPath 定位器。