我有一個自動化的硒腳本在一個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