gpt4 book ai didi

java - Selenium WebDriverException : unknown error: call function result missing 'value' using Java

转载 作者:行者123 更新时间:2023-12-01 07:18:23 25 4
gpt4 key购买 nike

当我尝试在 java 中使用 selenium webdriver 运行我的第一个测试用例时,出现以下异常。有人可以帮我吗请...

Starting ChromeDriver 2.33.506120 (e3e53437346286c0bc2d2dc9aa4915ba81d9023f) on port 48523
Only local connections are allowed.
log4j:WARN No appenders could be found for logger (org.apache.http.client.protocol.RequestAddCookies).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
Mar 29, 2018 7:34:16 AM org.openqa.selenium.remote.ProtocolHandshake createSession
INFO: Detected dialect: OSS
Exception in thread "main" org.openqa.selenium.WebDriverException: unknown error: call function result missing 'value'
(Session info: chrome=65.0.3325.181)
(Driver info: chromedriver=2.33.506120 (e3e53437346286c0bc2d2dc9aa4915ba81d9023f),platform=Windows NT 6.3.9600 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 31 milliseconds
Build info: version: '3.4.0', revision: 'unknown', time: 'unknown'
System info: host: 'NIL-MKODAGA-D13', ip: '172.16.20.242', os.name: 'Windows 8.1', os.arch: 'amd64', os.version: '6.3', java.version: '9.0.1'
Driver info: org.openqa.selenium.chrome.ChromeDriver
Capabilities [{applicationCacheEnabled=false, rotatable=false, mobileEmulationEnabled=false, networkConnectionEnabled=false, chrome= {chromedriverVersion=2.33.506120 (e3e53437346286c0bc2d2dc9aa4915ba81d9023f), userDataDir=C:\Users\mkodagan\AppData\Local\Temp\scoped_dir4652_10811}, takesHeapSnapshot=true, pageLoadStrategy=normal, databaseEnabled=false, handlesAlerts=true, hasTouchScreen=false, version=65.0.3325.181, platform=WIN8_1, browserConnectionEnabled=false, nativeEvents=true, acceptSslCerts=true, locationContextEnabled=true, webStorageEnabled=true, browserName=chrome, takesScreenshot=true, javascriptEnabled=true, cssSelectorsEnabled=true, setWindowRect=true, unexpectedAlertBehaviour=}]
Session ID: 1a39885769cc96406e2f2732c361c049
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.base/java.lang.reflect.Constructor.newInstance(Unknown Source)
at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:215)
at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:167)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:671)
at org.openqa.selenium.remote.RemoteWebElement.execute(RemoteWebElement.java:272)
at org.openqa.selenium.remote.RemoteWebElement.sendKeys(RemoteWebElement.java:96)
at com.ham.scripts.ClickOnAllLinks.main(ClickOnAllLinks.java:44)

最佳答案

错误说明了一切:

Exception in thread "main" org.openqa.selenium.WebDriverException: unknown error: call function result missing 'value'
(Session info: chrome=65.0.3325.181)
(Driver info: chromedriver=2.33.506120 (e3e53437346286c0bc2d2dc9aa4915ba81d9023f),platform=Windows NT 6.3.9600 x86_64)
Build info: version: '3.4.0', revision: 'unknown', time: 'unknown'
System info: host: 'NIL-MKODAGA-D13', ip: '172.16.20.242', os.name: 'Windows 8.1', os.arch: 'amd64', os.version: '6.3', java.version: '9.0.1'
Driver info: org.openqa.selenium.chrome.ChromeDriver

该错误清楚地表明 Selenium 客户端ChromeDriver 没有被检测到,如下所示:

Build info: version: '3.4.0', revision: 'unknown', time: 'unknown'  
Driver info: org.openqa.selenium.chrome.ChromeDriver

您的主要问题是您正在使用的二进制文件之间的版本兼容性,如下所示:

  • 您正在使用 chromedriver=2.33
  • chromedriver=2.33 的发行说明明确提到以下内容:

Supports Chrome v60-62

Supports Chrome v64-66

  • 您的 Selenium 客户端 版本是 3.4.0,其中版本稍旧。

因此,Selenium Client v3.4.0ChromeDriver 版本 (v2.33) 和 Chrome 浏览器版本 (v65.0)

解决方案

  • Selenium升级到当前级别 Version 3.11.0 .
  • ChromeDriver升级到当前的ChromeDriver v2.37级别。
  • Chrome 版本保持在 Chrome v65.x 级别。 (as per ChromeDriver v2.37 release notes)
  • 通过IDE清理您的项目工作区,并仅使用所需的依赖项重建项目。
  • 使用CCleaner工具可以清除执行测试套件之前和之后的所有操作系统杂务。
  • 如果您的基本网络客户端版本太旧,请通过 Revo Uninstaller 卸载它并安装最新的 GA 和已发布版本的Web 客户端
  • 重新启动系统
  • 执行您的@Test

关于java - Selenium WebDriverException : unknown error: call function result missing 'value' using Java,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49556405/

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