Webdriver 管理器下载最新版本的 chrome 驱动程序,Windows 的最新 chrome 版本不支持该驱动程序 [英] Webdriver manager downloads the latest version of chrome driver which is not supported for the latest chrome version for windows

查看:80
本文介绍了Webdriver 管理器下载最新版本的 chrome 驱动程序,Windows 的最新 chrome 版本不支持该驱动程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的 package.json 中有以下一行 -

I have the following piece of line in my package.json -

"webdriver-manager": "^12.1.7",

当我的量角器代码在 jenkins 管道中运行时,它会抛出一个错误 -

And when my protractor code runs in jenkins pipeline it throws me an error -

[01:11:30] I/testLogger - [chrome #01-12] PID: 12008
[chrome #01-12] Specs: C:\coco-e2e-5-2-2021\coco-web-client\apps\coco-e2e\outputFiles\JSFiles\view-comms-docs-tbs\view-comms.spec.js
[chrome #01-12]
[chrome #01-12] [01:11:29] I/direct - Using ChromeDriver directly...
[chrome #01-12] [01:11:30] E/runner - Unable to start a WebDriver session.
[chrome #01-12] [01:11:30] I/runnerCli - session not created: This version of ChromeDriver only supports Chrome version 90
[chrome #01-12] Current browser version is 89.0.4389.128 with binary path C:\Program Files (x86)\Google\Chrome\Application\chrome.exe
[chrome #01-12]   (Driver info: chromedriver=90.0.4430.24 (4c6d850f087da467d926e8eddb76550aed655991-refs/branch-heads/4430@{#429}),platform=Windows NT 10.0.18363 x86_64)

我从 Chrome 驱动程序的正式发布中看到的是,最新的 chromedriver 版本是 90.0.4430.24.但是 Windows 的最新 chrome 版本是 89.0.4389.128.这就是导致不匹配的原因.

What I see from Chrome driver's official release is, the latest chromedriver version is 90.0.4430.24. But the latest chrome version for windows is 89.0.4389.128. And this is what causing the mismatch.

Chrome 版本 90.0.4430.66 于 2021 年 4 月 14 日发布,但它与 Android chrome 兼容,而不与 Windows chrome 兼容.

There's a chrome version 90.0.4430.66 released on 14th April, 2021 but that's compatible with Android chrome and not with windows chrome.

现在如何调整我的代码,使其不使用 chromerdriver v89.0.4389.23 而不是 v90.0.4430.24?

Now how do I tweak my code so that it will not take the chromerdriver v89.0.4389.23 instead of v90.0.4430.24?

量角器测试不会在本地运行,而是通过 jenkins 在不同的系统上运行.因此,在本地更新 chromedriver 可能会解决我的调试问题,但不能解决在管道中运行测试的问题.

The protractor test will not run locally but on a different system via jenkins. So updating chromedriver locally may solve my problem for debugging but not for running the test in the pipeline.

非常感谢任何线索.提前致谢.

Any leads are very much appreciated. Thanks in advance.

推荐答案

你实际上需要做的是将本地 chrome 的版本与 chromedriver 的版本相匹配(驱动程序是控制浏览器的层,所以它是重要的是使它们相互对应).所以

what you actually need to do is to match a version of your local chrome to the version of chromedriver (the driver is the layer that controls your browser, so it's important to make them correspond to each other). So

首先,找出您的 chrome 版本.例如,它是 86.0.4240.111

First, find out what your version of chrome is. For example, it is 86.0.4240.111

然后,找出可以使用的chromedriver版本.获取浏览器的主要版本(前 3 个数字,在本例中为 86.0.4240)并通过转到此 url https://chromedriver.storage.googleapis.com/LATEST_RELEASE_${CHROME_VERSION}(将主要浏览器版本而不是 ${CHROME_VERSION}).你会看到你正在寻找的 chromedriver 是 86.0.4240.22

Then, find out what chromedriver version can be used. Take the major version of the browser (first 3 numbers, 86.0.4240 in this case) and find the corresponding version of the driver by going to this url https://chromedriver.storage.googleapis.com/LATEST_RELEASE_${CHROME_VERSION} (put the major browser version instead of ${CHROME_VERSION}). You'll see the chromedriver you're looking for is 86.0.4240.22

这是最棘手的部分开始的地方.量角器通常有两种安装方式:

This is where the trickiest part begins. There are 2 installation of protractor usually:

  • 本地
  • 全球

如何查找你使用的是哪一个,我就不赘述了,你可以自己查查.但是当你找到它时,请确保你更新的是正确的

I won't go over how to find which one you use, you can look it up. But when you find it, make sure you're updating the right one

当您知道要更新哪个量角器时,转到它的文件夹并从该文件夹运行 npm i webdriver-manager@latest 然后运行 ​​node ./bin/webdriver-manager 更新 --gecko=false

When you know which protractor you're updating, go to it's folder and from that folder run npm i webdriver-manager@latest and then node ./bin/webdriver-manager update --gecko=false

当你更新了正确的 webdriver 时,像这样安装正确的 chromedriver

when you updated the right webdriver, install the right chromedriver like so

node ./bin/webdriver-manager update --gecko=false --versions.chrome $VERSION

确保输入 86.0.4240.22 而不是 $VERSION

这篇关于Webdriver 管理器下载最新版本的 chrome 驱动程序,Windows 的最新 chrome 版本不支持该驱动程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆