我有一个自动化的硒脚本在一个maven项目中用于执行某些功能。问题是当我使用Testng的eclipse触发它时, 它失败并且eclipse引发了一些我无法重新使用的错误。 我附带了错误跟踪。 org.openqa.selenium.TimeoutException: Expected condition failed: waiting for presence of element located by: By.xpath: //*[text()='com.prism.soap.sftp.msg.mping.iflow']/../../../..//div[@class='OneByOne sapMGTHdrContent'] (tried for 25 second(s) with 2 SECONDS interval) at org.openqa.selenium.support.ui.FluentWait.timeoutException(FluentWait.java:264) at org.openqa.selenium.support.ui.FluentWait.until(FluentWait.java:232) at com.webui.Others.webui.tooling.Prism_Master_Class.webdriver_wait(Prism_Master_Class.java:47) at com.webui.Monitor.automation.Prism_Selenium_Monitor_Tab.prism_monitor_messageProcessing(Prism_Selenium_Monitor_Tab.java:732) at com.webui.Others.webui.tooling.Message_Processing_Vaidation.messageProcessingCheck(Message_Processing_Vaidation.java:21) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:85) at org.testng.internal.Invoker.invokeMethod(Invoker.java:639) at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:816) at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1124) at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:125) at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:108) at org.testng.TestRunner.privateRun(TestRunner.java:774) at org.testng.TestRunner.run(TestRunner.java:624) at org.testng.SuiteRunner.runTest(SuiteRunner.java:359) at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:354) at org.testng.SuiteRunner.privateRun(SuiteRunner.java:312) at org.testng.SuiteRunner.run(SuiteRunner.java:261) at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52) at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86) at org.testng.TestNG.runSuitesSequentially(TestNG.java:1215) at org.testng.TestNG.runSuitesLocally(TestNG.java:1140) at org.testng.TestNG.run(TestNG.java:1048) at org.testng.remote.AbstractRemoteTestNG.run(AbstractRemoteTestNG.java:132) at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:230) at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:76) Caused by: org.openqa.selenium.NoSuchElementException: Cannot locate an element using By.xpath: //*[text()='com.prism.soap.sftp.msg.mping.iflow']/../../../..//div[@class='OneByOne sapMGTHdrContent'] For documentation on this error, please visit: http://seleniumhq.org/exceptions/no_such_element.html Build info: version: '3.4.0', revision: 'unknown', time: 'unknown' System info: host: 'INLN50942827A', ip: '10.53.219.90', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_131' Driver info: driver.version: unknown at org.openqa.selenium.support.ui.ExpectedConditions.lambda$findElement$0(ExpectedConditions.java:883) at java.util.Optional.orElseThrow(Unknown Source) at org.openqa.selenium.support.ui.ExpectedConditions.findElement(ExpectedConditions.java:882) at org.openqa.selenium.support.ui.ExpectedConditions.access$000(ExpectedConditions.java:44) at org.openqa.selenium.support.ui.ExpectedConditions$6.apply(ExpectedConditions.java:183) at org.openqa.selenium.support.ui.ExpectedConditions$6.apply(ExpectedConditions.java:180) at org.openqa.selenium.support.ui.FluentWait.until(FluentWait.java:209) ... 27 more
运行硒脚本时出错
Q
运行硒脚本时出错
-1
A
回答
0
您的错误似乎是由于使用您的定位器代码找不到元素而引起的,因此称为NoSuchElementException。再次检查您的代码。
相关问题
- 1. 运行简单shell脚本时出错
- 2. 从powershell脚本运行cmd时出错
- 3. 运行ruby脚本时出错
- 4. 运行screeps时出错脚本
- 5. 运行sql * plus脚本时出错
- 6. 运行Screeps游戏脚本时出错
- 7. 运行shell脚本时出错
- 8. 从AppleScript运行Python脚本时出错
- 9. 运行我的Python脚本时出错
- 10. 通过C#运行硒时出错
- 11. 运行firefox时出现硒错误
- 12. 脚本运行时硒不显示弹出
- 13. 在运行硒脚本时找不到类'org.openqa.selenium.android.AndroidDriver'错误
- 14. 如何在硒节点闲置时运行脚本(硒网格)
- 15. 在package.json脚本对象上运行“纱线运行”时出错
- 16. 硒-Java运行时错误
- 17. 执行硒时出错
- 18. 在Internet Explorer中运行硒脚本
- 19. 通过cmd运行硒独立脚本
- 20. 无法通过testng运行硒脚本
- 21. 在Cronjob上运行ruby硒脚本 - Chrome
- 22. 运行硒webdriver的脚本在Chrome
- 23. 运行Perl脚本时在文本/ CSV.pm上出现错误
- 24. 获取Python脚本在旧版本上运行时出错
- 25. 尝试在本地运行U-SQL脚本时出错
- 26. 运行猪脚本时出现异常
- 27. 无法使用硒在Firefox 50.1.0上运行硒脚本3.3.1
- 28. 硒 - 找出脚本是从
- 29. SSIS脚本组件运行时错误
- 30. 运行时错误9在VBA脚本
你错误读取'NoSuchElementException'这是findElement无法找到您正在寻找的实际WebElement时可能的。 – nullpointer