我在酱汁实验室使用远程Web驱动程序进行ui测试时遇到一个奇怪的错误。告诉驾驶员等到元素定位后就会发生这种情况。
LibraryGlideModule
并且错误并非总是会发生。
await browser.wait(until.elementsLocated(By.css('#divID .someInnerClass')));
这是完整的堆栈跟踪:
WebDriverError: org.openqa.selenium.remote.RemoteWebElement cannot be cast to java.util.List
远程Web驱动程序的功能:
WebDriverError: org.openqa.selenium.remote.RemoteWebElement cannot be cast to java.util.List
[slee..some] at Object.checkLegacyResponse (node_modules/selenium-webdriver/lib/error.js:529:15)
[slee..some] at parseHttpResponse (node_modules/selenium-webdriver/lib/http.js:509:13)
[slee..some] at doSend.then.response (node_modules/selenium-webdriver/lib/http.js:441:30)
[slee..some] at process._tickCallback (internal/process/next_tick.js:68:7)
[slee..some] From: Task: WebDriver.findElements(By(css selector, #divID .someInnerClass))
[slee..some] at thenableWebDriverProxy.schedule (node_modules/selenium-webdriver/lib/webdriver.js:807:17)
[slee..some] at thenableWebDriverProxy.findElements (node_modules/selenium-webdriver/lib/webdriver.js:1048:22)
[slee..some] at /Users/username/workspace/node_modules/selenium-webdriver/lib/until.js:265:23
[slee..some] at /Users/username/workspace/node_modules/selenium-webdriver/lib/webdriver.js:938:14
[slee..some] at TaskQueue.execute_ (node_modules/selenium-webdriver/lib/promise.js:3092:14)
[slee..some] at TaskQueue.executeNext_ (node_modules/selenium-webdriver/lib/promise.js:3075:27)
[slee..some] at asyncRun (node_modules/selenium-webdriver/lib/promise.js:2982:25)
[slee..some] at /Users/username/workspace/node_modules/selenium-webdriver/lib/promise.js:676:7
[slee..some] at process._tickCallback (internal/process/next_tick.js:68:7)
[slee..some] From: Task: <anonymous>
[slee..some] at pollCondition (node_modules/selenium-webdriver/lib/promise.js:2203:19)
[slee..some] at /Users/username/workspace/node_modules/selenium-webdriver/lib/promise.js:2199:7
[slee..some] at new ManagedPromise (node_modules/selenium-webdriver/lib/promise.js:1085:7)
[slee..some] at ControlFlow.promise (node_modules/selenium-webdriver/lib/promise.js:2513:12)
[slee..some] at /Users/username/workspace/node_modules/selenium-webdriver/lib/promise.js:2198:22
[slee..some] at TaskQueue.execute_ (node_modules/selenium-webdriver/lib/promise.js:3092:14)
[slee..some] at TaskQueue.executeNext_ (node_modules/selenium-webdriver/lib/promise.js:3075:27)
[slee..some] at asyncRun (node_modules/selenium-webdriver/lib/promise.js:2982:25)
[slee..some] at /Users/username/workspace/node_modules/selenium-webdriver/lib/promise.js:676:7
[slee..some] at process._tickCallback (internal/process/next_tick.js:68:7)
[slee..some] From: Task: Waiting for at least one element to be located By(css selector, #divID .someInnerClass)
[slee..some] at scheduleWait (node_modules/selenium-webdriver/lib/promise.js:2196:20)
[slee..some] at ControlFlow.wait (node_modules/selenium-webdriver/lib/promise.js:2525:12)
[slee..some] at thenableWebDriverProxy.wait (node_modules/selenium-webdriver/lib/webdriver.js:934:29)
[slee..some] at Context.<anonymous> (ui-tests/sanity.test.js:85:23)
[slee..some] at process._tickCallback (internal/process/next_tick.js:68:7)
有人见过吗?我做了一些谷歌搜索,并在Java中找到了一个类似的问题,该问题涉及使用findElements而不是findElement,但是您可以看到我正在使用elementsLocated,它返回一个列表,所以我不知道为什么会这样。