Java 更新到 ChromeDriver 2.46 后,Chrome 版本必须介于 71 和 75 之间
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/54940853/
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
Chrome version must be between 71 and 75 error after updating to ChromeDriver 2.46
提问by Suule
After update of chromedriver to version 2.46 my tasts fail to initialize. I got message like this:
将 chromedriver 更新到 2.46 版后,我的 tast 无法初始化。我收到这样的消息:
Starting ChromeDriver 2.46.628402 (536cd7adbad73a3783fdc2cab92ab2ba7ec361e1) on port 44269
Only local connections are allowed.
Please protect ports used by ChromeDriver and related test frameworks to prevent access by malicious code.
Failed to invoke configuration method com.personal.CustomTest.initTests not created: Chrome version must be between 71 and 75
(Driver info: chromedriver=2.46.628402,platform=Windows NT 10.0.16299 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 1.58 seconds
Build info: version: '2.53.1'
It is clearly saying that my browser version is not valid. But I am using Chrome 72.0.3626.119 so it is between 71 and 75. Selenium version is 2.53.1. And I am running test through console command with the help of testNG.
很明显我的浏览器版本无效。但是我使用的是 Chrome 72.0.3626.119,所以它在 71 到 75 之间。Selenium 版本是 2.53.1。我在 testNG 的帮助下通过控制台命令运行测试。
Any idea? Every ideas that I found was about changing selenium version but I cant do it.
任何的想法?我发现的每一个想法都是关于改变 selenium 版本的,但我做不到。
采纳答案by DebanjanB
This error message...
这个错误信息...
Starting ChromeDriver 2.46.628402 (536cd7adbad73a3783fdc2cab92ab2ba7ec361e1) on port 44269
Only local connections are allowed.
Please protect ports used by ChromeDriver and related test frameworks to prevent access by malicious code.
Failed to invoke configuration method com.personal.CustomTest.initTests not created: Chrome version must be between 71 and 75
...implies that the ChromeDriver v2.46is not compatible with the Chrome Browserversion which is being accessed by your program/webdriver.
...暗示ChromeDriver v2.46与您的程序/网络驱动程序正在访问的Chrome 浏览器版本不兼容。
Your main issue is the incompatibilitybetween the version of the binaries you are using as follows:
您的主要问题是您使用的二进制文件版本之间的不兼容,如下所示:
- You are using chromedriver=2.46
- Release Notes of chromedriver=2.46clearly mentions the following :
- 您正在使用chromedriver=2.46
- chromedriver=2.46 的发行说明清楚地提到了以下内容:
Supports Chrome v71-73
支持Chrome v71-73
Though you mentioned you are using Chrome 72.0.3626.119possibly there are multiple instances of Chrome Browserinstalled within your system and your program by default is accessing the Chrome Browserwhose version is not between
v71.x
andv75.x
You are using chrome=67.0
- Release Notes of ChromeDriver v2.38clearly mentions the following :
尽管您提到您使用的是Chrome 72.0.3626.119,但您的系统中可能安装了多个Chrome 浏览器实例,并且您的程序默认访问的Chrome 浏览器版本不在
v71.x
和v75.x
您正在使用chrome=67.0
- ChromeDriver v2.38 的发行说明清楚地提到了以下内容:
Supports Chrome v65-67
支持Chrome v65-67
Solution
解决方案
- Keep JDKupgraded to recent levels JDK 8u201.
- Uninstall all the instances of Chrome Browser(you can opt to use Revo Uninstaller).
- Upgrade ChromeDriverto current ChromeDriver v2.46level.
- Keep Chromeversion between Chrome v71-73levels. (as per ChromeDriver v2.46 release notes)
- 保持JDK升级到最新级别JDK 8u201。
- 卸载Chrome 浏览器的所有实例(您可以选择使用Revo Uninstaller)。
- 升级ChromeDriver当前ChromeDriver v2.46水平。
- 将Chrome版本保持在Chrome v71-73级别之间。(根据 ChromeDriver v2.46 发行说明)
回答by C_Sutt
For me, I had to update my chrome driver in my project to match the version of Chrome on my local machine.
对我来说,我必须在我的项目中更新我的 chrome 驱动程序以匹配我本地机器上的 Chrome 版本。
yarn add [email protected] -D
纱线添加 [email protected] -D
回答by jissay
For me to resolve this problem :
让我来解决这个问题:
On Windows
在 Windows 上
cd C:\Users\[myname]\AppData\Roaming\npm\node_modules\protractor
npm i webdriver-manager@latest
webdriver-manager update
webdriver-manager start &
On Cent-OS(I used Cent-OS 7.4.* and it worked fine.)
在 Cent-OS 上(我使用 Cent-OS 7.4.* 并且运行良好。)
cd /usr/lib/node_modules/protractor/
sudo npm i webdriver-manager@latest
sudo webdriver-manager update
sudo webdriver-manager start &
I hope this helps you in any way.
我希望这能以任何方式帮助你。
回答by Salih Igde
In my case I was getting the same error after my chrome was updated to version 76. Which was happening when chimp
tries to use chromedriver
to execute the selenium test.
在我的情况下,在我的 chrome 更新到版本 76 后,我遇到了同样的错误。这是在chimp
尝试使用chromedriver
硒测试时发生的。
DevTools listening on ws://127.0.0.1:49220/devtools/browser/e88586cb-ed67-44fc-a742-43b767e2b8f9
[chimp][helper] setupBrowserAndDDP had error
{ Error: session not created: Chrome version must be between 71 and 75
at Object.wait (C:\ACPMS\ELS_AT\node_modules\fibers\future.js:449:15)
at Object.<anonymous> (C:\ACPMS\ELS_AT\node_modules\wdio-sync\build\index.js:344:27)
at Object.<anonymous> (C:\ACPMS\ELS_AT\node_modules\chimp\dist\lib\session-manager.js:145:21)
at initBrowser (C:\ACPMS\ELS_AT\node_modules\chimp\dist\lib\chimp-helper.js:189:43)
at Object.setupBrowserAndDDP (C:\ACPMS\ELS_AT\node_modules\chimp\dist\lib\chimp-helper.js:264:7)
at Context.<anonymous> (C:\ACPMS\ELS_AT\node_modules\chimp\dist\lib\mocha\mocha-helper.js:13:15)
at C:\ACPMS\ELS_AT\node_modules\chimp\dist\lib\utils\fiberize.js:29:22
(Driver info: chromedriver=2.46.628402 (536cd7adbad73a3783fdc2cab92ab2ba7ec361e1),platform=Windows NT 10.0.17134 x86_64)
at new RuntimeError (C:\ACPMS\ELS_AT\node_modules\webdriverio\build\lib\utils\ErrorHandler.js:143:12)
at Request._callback (C:\ACPMS\ELS_AT\node_modules\webdriverio\build\lib\utils\RequestHandler.js:318:39)
at Request.self.callback (C:\ACPMS\ELS_AT\node_modules\request\request.js:185:22)
at emitTwo (events.js:106:13)
at Request.emit (events.js:191:7)
at Request.<anonymous> (C:\ACPMS\ELS_AT\node_modules\request\request.js:1161:10)
at emitOne (events.js:96:13)
at Request.emit (events.js:188:7)
at IncomingMessage.<anonymous>
For me it didn't work when I updated the chrome driver by npm (both globally and locally) and then I followed these steps to resolve the issue, which might give some idea on where to check in this kind a issue:
对我来说,当我通过 npm(全局和本地)更新 chrome 驱动程序时它不起作用,然后我按照以下步骤解决了这个问题,这可能会给我一些关于在哪里检查此类问题的想法:
- Because exception was thrown in
node_modules\chimp\dist\lib\utils\fiberize.js
i navigated to that file and found one level above this filenode_modules\chimp\dist\lib\chromedriver.js
which has the code to start chromedriver. - I added a console.log to chromedriverPath which can be seen below and re-executed the tests to get the chromedriver path in console logs.
- 因为抛出异常,
node_modules\chimp\dist\lib\utils\fiberize.js
我导航到该文件并找到了该文件上方的一个级别,该文件node_modules\chimp\dist\lib\chromedriver.js
具有启动 chromedriver 的代码。 - 我向 chromedriverPath 添加了一个 console.log,如下所示,并重新执行测试以获取控制台日志中的 chromedriver 路径。
Chromedriver.prototype.start = function(callback) { var self = this; var port = self.options.port; if (this.child) { callback(); return; } var chromedriverPath = chromedriver.path; //this was added my me the see that chrome drive path console.log("[chimp] " + chromedriverPath); if (fs.existsSync(chromedriverPath)) { this.child = processHelper.start( { bin: chromedriverPath, prefix: "chromedriver", args: ["--port=" + port, "--url-base=wd/hub"], waitForMessage: /Starting ChromeDriver/, errorMessage: /Error/ }, callback ); } else { callback("[chimp][chromedriver] Chromedriver executable not found."); } };
- When i got the path of the chromedriver which is used to execute the tests, i just navigated to that folder and replaced
chromedriver
executable with the most recent version.
- 当我获得用于执行测试的 chromedriver 的路径时,我只是导航到该文件夹并将
chromedriver
可执行文件替换为最新版本。
I hope this helps.
我希望这有帮助。
回答by Suvra Nandi
Try this: Download the compatible ChromeDriver.exe file for the updated version of Chrome browser and replace it. It works for me.
试试这个:下载适用于 Chrome 浏览器更新版本的兼容 ChromeDriver.exe 文件并替换它。这个对我有用。