Java org.openqa.selenium.WebDriverException:未知错误:调用函数结果缺少“值”

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/48609069/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-12 02:53:42  来源:igfitidea点击:

org.openqa.selenium.WebDriverException: unknown error: call function result missing 'value'

javagoogle-chromeseleniumselenium-webdriverselenium-chromedriver

提问by maharaja

Sendkeys not working. Please help me to resolve this..

发送键不起作用。请帮我解决这个问题..

WebElement username = driver.findElement(By.xpath("//*[@id='username']"));      
username.sendKeys("123456");

Console:

安慰:

Exception in thread "main" org.openqa.selenium.WebDriverException: unknown error: call function result missing 'value'

  (Session info: chrome=65.0.3325.31)
  (Driver info: chromedriver=2.33.506120 (e3e53437346286c0bc2d2dc9aa4915ba81d9023f),platform=Windows NT 6.1.7601 SP1 x86) 
(WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 0 milliseconds

Build info: version: '3.8.1', revision: '6e95a6684b', time: '2017-12-01T19:05:32.194Z'
System info: host: 'NEW-PC', ip: '192.168.0.103', os.name: 'Windows 7', os.arch: 'x86', os.version: '6.1', java.version: '1.8.0_161'

Driver info:

司机资料:

org.openqa.selenium.chrome.ChromeDriver

Capabilities {acceptSslCerts: true, applicationCacheEnabled: false, browserConnectionEnabled: false, browserName: chrome, chrome: {chromedriverVersion: 2.33.506120 (e3e53437346286..., userDataDir: C:\Users\NEW\AppData\Local\...}, cssSelectorsEnabled: true, databaseEnabled: false, handlesAlerts: true, hasTouchScreen: false, javascriptEnabled: true, locationContextEnabled: true, mobileEmulationEnabled: false, nativeEvents: true, networkConnectionEnabled: false, pageLoadStrategy: normal, platform: XP, platformName: XP, rotatable: false, setWindowRect: true, takesHeapSnapshot: true, takesScreenshot: true, unexpectedAlertBehaviour: , unhandledPromptBehavior: , version: 65.0.3325.31, webStorageEnabled: true}

采纳答案by Martijn

I was seeing the same issue. The problem only appears when using Chrome 65 (currently: dev channel). With Chrome 64 (both stable channel and beta channel) everything worked fine.

我看到了同样的问题。该问题仅在使用 Chrome 65(当前:开发频道)时出现。使用 Chrome 64(稳定频道和测试版频道)一切正常。

It turns out I had an old chromedriver installed. Specifically, I was using chrome=65.0.3325.51with chromedriver=2.29.461585. Running npm install -g chromedriverbumped chromedriver to 2.35.528157 and now the problem is solved. Hope this helps!

原来我安装了一个旧的 chromedriver。具体来说,我使用的chrome=65.0.3325.51chromedriver=2.29.461585. npm install -g chromedriver将 chromedriver运行到 2.35.528157,现在问题解决了。希望这可以帮助!

TL;DR: run npm install -g chromedriver

TL;DR:运行npm install -g chromedriver

回答by Kumar Abhishek

I have encountered the same issue and installed the chrome drive. Issue got resolved.

我遇到了同样的问题并安装了chrome驱动器。问题得到解决。

npm install chromedriver --chromedriver_version=LATEST

npm 安装 chromedriver --chromedriver_version=LATEST

回答by user1660026

The latest chrome browser requires corresponding latest chromedriver executable for the tests to run.

最新的 chrome 浏览器需要相应的最新 chromedriver 可执行文件才能运行测试。

回答by Matt

You may need to update you driver the link for all the chromedriver updates are http://chromedriver.storage.googleapis.com/index.htmlmake sure you chromedriver corresponds to your version of chrome

您可能需要更新您的驱动程序所有 chromedriver 更新的链接是http://chromedriver.storage.googleapis.com/index.html确保您的 chromedriver 对应于您的 chrome 版本

回答by RohitKumar

Changing latest version of ChromDriver worked for me.

更改最新版本的 ChromDriver 对我有用。

回答by DebanjanB

The error says it all :

错误说明了一切:

Exception in thread "main" org.openqa.selenium.WebDriverException: unknown error: call function result missing 'value'

  (Session info: chrome=65.0.3325.31)
  (Driver info: chromedriver=2.33.506120 (e3e53437346286c0bc2d2dc9aa4915ba81d9023f),platform=Windows NT 6.1.7601 SP1 x86) 
(WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 0 milliseconds

Build info: version: '3.8.1', revision: '6e95a6684b', time: '2017-12-01T19:05:32.194Z'  

Your main issue is the version compatibilitybetween the binaries you are using as follows :

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

  • You are using chromedriver=2.33
  • Release Notes of chromedriver=2.33clearly mentions the following :

Supports Chrome v60-62

支持Chrome v60-62

  • You are using chrome=65.0
  • Release Notes of ChromeDriver v2.37clearly mentions the following :

Supports Chrome v64-66

支持Chrome v64-66

So there is a clear mismatch between the ChromeDriverversion (v2.33) and the Chrome Browserversion (v65.0)

因此ChromeDriver版本 ( v2.33) 和Chrome 浏览器版本 ( v65.0)之间存在明显的不匹配

Solution

解决方案

  • Upgrade ChromeDriverto current ChromeDriver v2.37level.
  • Keep Chromeversion at Chrome v65.xlevels. (as per ChromeDriver v2.37 release notes)
  • Cleanyour Project Workspacethrough your IDEand Rebuildyour project with required dependencies only.
  • Use CCleanertool to wipe off all the OS chores before and after the execution of your test Suite.
  • If your base Web Clientversion is too old, then uninstall it through Revo Uninstallerand install a recent GA and released version of Web Client.
  • Execute your @Test.
  • 升级ChromeDriver当前ChromeDriver v2.37水平。
  • Chrome版本保持在Chrome v65.x级别。(根据 ChromeDriver v2.37 发行说明
  • 清理你的项目工作,通过你的IDE重建仅需要依赖你的项目。
  • 在执行测试套件之前和之后,使用CCleaner工具清除所有操作系统杂务。
  • 如果您的基本Web Client版本太旧,请通过Revo Uninstaller卸载它并安装最新的 GA 和发布版本的Web Client
  • 执行您的@Test.

回答by nix86

I simply installed a new version of Katalon Studio and it has worked fine.

我只是安装了一个新版本的 Katalon Studio,它运行良好。

回答by sree

This issue happens when chrome and chromedriver are not in sync. Either update both to the latest version or make sure they can work together. After running the following commands it worked for me

当 chrome 和 chromedriver 不同步时会发生此问题。要么将两者都更新到最新版本,要么确保它们可以一起工作。运行以下命令后,它对我有用

npm install -g chromedriver --chromedriver-force-download
webdriver-manager update