gpt4 book ai didi

java - table.findElements(By.tagName ("td") 在 RemoteWebDriver/Internet Explorer 中失败

转载 作者:行者123 更新时间:2023-12-01 08:48:50 26 4
gpt4 key购买 nike

我有一系列 Selenium 测试,这些测试是使用 Internet Explorer 中的 Selenium Grid 远程运行的。测试工作正常,直到到达此行:

WebElement cart = driver.findElement(By.id("cartId");
List<WebElement> rows = cart.findElements(By.tagName("tr")); <----- fails here.

使用 Chrome 在本地运行时,代码可以完美运行,并且远程 IE 测试中有几个步骤会在该步骤之前运行。如果我替换 tabledriver' (to see if the issue is somehow查找元素) the tests pass (at that point). There are certainly表中的 tr` 元素和堆栈跟踪没有给我很好的方法来弄清楚发生了什么(我在下面列出)。任何帮助将不胜感激。

[TestNG] Running:
/Users/kroe761/Documents/workspace/ecom/testng.xml

Feb 28, 2017 2:13:01 PM org.openqa.selenium.remote.ProtocolHandshake createSession
INFO: Attempting bi-dialect session, assuming Postel's Law holds true on the remote end
Feb 28, 2017 2:13:04 PM org.openqa.selenium.remote.ProtocolHandshake createSession
INFO: Detected dialect: OSS

FAILED: MyTest
org.openqa.selenium.WebDriverException: org/openqa/selenium/remote/server/handler/FindChildElements$1
Command duration or timeout: 80 milliseconds
Build info: version: '3.0.1', revision: '1969d75', time: '2016-10-18 09:49:13 -0700'
System info: host: 'kroe761-MacBook-Pro.local', ip: '10.11.25.155', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.12.3', java.version: '1.8.0_121'
Driver info: org.openqa.selenium.remote.RemoteWebDriver
Capabilities [{browserAttachTimeout=0, ie.enableFullPageScreenshot=true, enablePersistentHover=false, ie.forceCreateProcessApi=false, ie.forceShellWindowsApi=false, pageLoadStrategy=normal, ignoreZoomSetting=false, ie.fileUploadDialogTimeout=3000, version=11, platform=WINDOWS, nativeEvents=true, ie.ensureCleanSession=false, elementScrollBehavior=0, ie.browserCommandLineSwitches=, webdriver.remote.sessionid=0a293271-4edc-428e-b845-1b5ed71c0f1d, requireWindowFocus=false, browserName=internet explorer, initialBrowserUrl=http://localhost:4747/, takesScreenshot=true, javascriptEnabled=true, ignoreProtectedModeSettings=false, enableElementCacheCleanup=true, cssSelectorsEnabled=true, unexpectedAlertBehaviour=dismiss}]
Session ID: 0a293271-4edc-428e-b845-1b5ed71c0f1d
*** Element info: {Using=tag name, value=tr}
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:216)
at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:168)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:635)
at org.openqa.selenium.remote.RemoteWebElement.execute(RemoteWebElement.java:274)
at org.openqa.selenium.remote.RemoteWebElement.findElements(RemoteWebElement.java:193)
at org.openqa.selenium.remote.RemoteWebElement.findElementsByTagName(RemoteWebElement.java:270)
at org.openqa.selenium.By$ByTagName.findElements(By.java:327)
at org.openqa.selenium.remote.RemoteWebElement.findElements(RemoteWebElement.java:169)
at com.company.automation.ecom.pages.checkout.Cart.getCartItemRows(Cart.java:56)
at com.company.automation.ecom.pages.checkout.Cart.getNumOfRowsInCart(Cart.java:74)
at com.company.automation.ecom.tests.checkout.CheckoutHelper.comparePricesOnCart(CheckoutHelper.java:59)
at com.company.automation.ecom.tests.checkout.CheckoutCreditCard.CreditCard(CheckoutCreditCard.java:102)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:80)
at org.testng.internal.Invoker.invokeMethod(Invoker.java:714)
at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:901)
at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1231)
at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:127)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:111)
at org.testng.TestRunner.privateRun(TestRunner.java:767)
at org.testng.TestRunner.run(TestRunner.java:617)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:334)
at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:329)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:291)
at org.testng.SuiteRunner.run(SuiteRunner.java:240)
at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
at org.testng.TestNG.runSuitesSequentially(TestNG.java:1198)
at org.testng.TestNG.runSuitesLocally(TestNG.java:1123)
at org.testng.TestNG.run(TestNG.java:1031)
at org.testng.remote.AbstractRemoteTestNG.run(AbstractRemoteTestNG.java:132)
at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:236)
at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:81)
Caused by: java.lang.NoClassDefFoundError: org/openqa/selenium/remote/server/handler/FindChildElements$1
at org.openqa.selenium.remote.server.handler.FindChildElements.call(FindChildElements.java:50)
at org.openqa.selenium.remote.server.handler.FindChildElements.call(FindChildElements.java:35)
at java.util.concurrent.FutureTask.run(Unknown Source)
at org.openqa.selenium.remote.server.DefaultSession$1.run(DefaultSession.java:176)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)


===============================================
Internet Explorer
Tests run: 1, Failures: 1, Skips: 0
===============================================


===============================================
ECOM Suite
Total tests run: 1, Failures: 1, Skips: 0
===============================================

[TestNG] Time taken by [FailedReporter passed=0 failed=0 skipped=0]: 7 ms
[TestNG] Time taken by org.testng.reporters.JUnitReportReporter@22f71333: 5 ms
[TestNG] Time taken by org.testng.reporters.SuiteHTMLReporter@7e0ea639: 11 ms
[TestNG] Time taken by org.testng.reporters.XMLReporter@7f690630: 12 ms
[TestNG] Time taken by org.testng.reporters.jq.Main@71be98f5: 34 ms
[TestNG] Time taken by org.testng.reporters.EmailableReporter@6108b2d7: 4 ms

最佳答案

根据您的日志,这与 Internet Explorer 驱动程序或表元素无关,您在远程计算机上执行此测试时存在类路径问题。您在 FindChildElements 类上收到 NoClassDefFoundError

我不知道你的构建过程和项目结构是什么样的,但请参阅 here了解如何解决此类问题的更多详细信息。

关于java - table.findElements(By.tagName ("td") 在 RemoteWebDriver/Internet Explorer 中失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42518142/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com