Chrome驱动只支持Chrome版本89

ChromeDriver only supports Chrome version 89

使用 Azure DevOps,当我 运行 ng lint && ng e2e && ng test --watch=false 时,管道以某种方式停止工作,我无法完成测试。这在 运行ning 本地时有效。

[16:43:25] I/launcher - Running 1 instances of WebDriver
[16:43:25] I/direct - Using ChromeDriver directly...
[16:43:27] E/launcher - session not created: This version of ChromeDriver only supports Chrome version 89
Current browser version is 88.0.4298.0 with binary path D:\a\s\node_modules\puppeteer\.local-chromium\win64-818858\chrome-win\chrome.exe
  (Driver info: chromedriver=89.0.4389.23 (61b08ee2c50024bab004e48d2b1b083cdbdac579-refs/branch-heads/4389@{#294}),platform=Windows NT 10.0.17763 x86_64)
[16:43:27] E/launcher - SessionNotCreatedError: session not created: This version of ChromeDriver only supports Chrome version 89
Current browser version is 88.0.4298.0 with binary path D:\a\s\node_modules\puppeteer\.local-chromium\win64-818858\chrome-win\chrome.exe
  (Driver info: chromedriver=89.0.4389.23 (61b08ee2c50024bab004e48d2b1b083cdbdac579-refs/branch-heads/4389@{#294}),platform=Windows NT 10.0.17763 x86_64)
    at Object.checkLegacyResponse (D:\a\s\node_modules\selenium-webdriver\lib\error.js:546:15)
    at parseHttpResponse (D:\a\s\node_modules\selenium-webdriver\lib\http.js:509:13)
    at D:\a\s\node_modules\selenium-webdriver\lib\http.js:441:30
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
From: Task: WebDriver.createSession()
    at Function.createSession (D:\a\s\node_modules\selenium-webdriver\lib\webdriver.js:769:24)
    at Function.createSession (D:\a\s\node_modules\selenium-webdriver\chrome.js:761:15)
    at Direct.getNewDriver (D:\a\s\node_modules\protractor\built\driverProviders\direct.js:77:33)
    at Runner.createBrowser (D:\a\s\node_modules\protractor\built\runner.js:195:43)
    at D:\a\s\node_modules\protractor\built\runner.js:339:29
    at _fulfilled (D:\a\s\node_modules\protractor\node_modules\q\q.js:834:54)
    at D:\a\s\node_modules\protractor\node_modules\q\q.js:863:30
    at Promise.promise.promiseDispatch (D:\a\s\node_modules\protractor\node_modules\q\q.js:796:13)
    at D:\a\s\node_modules\protractor\node_modules\q\q.js:556:49
    at runSingle (D:\a\s\node_modules\protractor\node_modules\q\q.js:137:13)
[16:43:27] E/launcher - Process exited with error code 199
##[error]Cmd.exe exited with code '1'.

这是我设置流水线任务的方式

傀儡师

cd node_modules/puppeteer
npm install
npm install webdriver-manager@latest
> puppeteer@5.5.0 install D:\a\s\node_modules\puppeteer
> node install.js

Chromium is already in D:\a\s\node_modules\puppeteer\.local-chromium\win64-818858; skipping download.

> puppeteer@5.5.0 prepare D:\a\s\node_modules\puppeteer
> node typescript-if-required.js

added 848 packages from 915 contributors and audited 860 packages in 43.745s

96 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities

Finishing: npm install puppeteer

ng测试

ng lint && ng e2e && ng test --watch=false

根据文档:Microsoft Windows Server 2019 Datacenter 和 Ubuntu 20.04.2 LTS。我们发现我们的托管代理上只有 ChromeDriver 88.0.4324.96。

所以我们有两个建议:

  1. 我们注意到测试在您的本地机器上运行良好,因此我们可以尝试在您的本地机器上安装一个自代理并使用新代理重试。

  2. 我们可以添加一个bash任务,然后使用下面的脚本先安装最新版本的ChromeDriver。

    npm 安装 chromedriver --chromedriver_cdnurl=https://chromedriver.storage.googleapis.com/89.0.4389.23/chromedriver_win32.zip

因为您正在使用 javascript

yarn 添加 chromedriver --chromedriver-force-download

npm install --save-dev chromedriver --chromedriver-force-download

https://github.com/giggio/node-chromedriver/issues/311