尝试在Angular应用的VSCode中运行E2E时出现“ E /启动器-未创建会话:Chrome版本必须介于71和75之间”

时间:2019-09-03 18:33:18

标签: angular selenium-webdriver visual-studio-code protractor webdriver

我试图在VSCode中为Angular应用程序运行e2e(命令:ng e2e),但出现以下错误。

我的环境:

  • 赢10
  • VS代码版本:1.37.1
  • Chrome版本:76.0.3809.132版(正式版本)(64位)

如何更新chromedriver以匹配Chrome版本?

Your global Angular CLI version (7.3.8) is greater than your local
version (7.3.5). The local Angular CLI version is used.

To disable this warning use "ng config -g cli.warnings.versionMismatch false".
** Angular Live Development Server is listening on localhost:4200, open your browser on http://localhost:4200/ **
 22% building 103/109 modules 6 active ...e\workflow-manager-table.component.scssBrowserslist: caniuse-lite is outdated. Please run next command `npm update caniuse-lite browserslist`

Date: 2019-09-03T18:20:59.131Z
Hash: 3ced9271ad10fcdd845e
Time: 14922ms
chunk {es2015-polyfills} es2015-polyfills.js, es2015-polyfills.js.map (es2015-polyfills) 284 kB [initial] [rendered]
chunk {main} main.js, main.js.map (main) 4.17 MB [initial] [rendered]
chunk {polyfills} polyfills.js, polyfills.js.map (polyfills) 236 kB [initial] [rendered]
chunk {runtime} runtime.js, runtime.js.map (runtime) 6.08 kB [entry] [rendered]
chunk {styles} styles.js, styles.js.map (styles) 1.11 MB [initial] [rendered]
chunk {vendor} vendor.js, vendor.js.map (vendor) 7.93 MB [initial] [rendered]

WARNING in ./node_modules/@angular/material/esm5/tree.es5.js 38:63-88
"export 'CDK_TREE_NODE_OUTLET_NODE' was not found in '@angular/cdk/tree'

WARNING in ./node_modules/@angular/material/esm5/tree.es5.js 168:35-60
"export 'CDK_TREE_NODE_OUTLET_NODE' was not found in '@angular/cdk/tree'
[11:20:59] I/file_manager - creating folder C:\_VSTS\OkhamaMD\OkhamaMDWebDemo\UI\node_modules\protractor\node_modules\webdriver-manager\selenium
[11:20:59] I/config_source - curl -oC:\_VSTS\OkhamaMD\OkhamaMDWebDemo\UI\node_modules\protractor\node_modules\webdriver-manager\selenium\chrome-response.xml https://chromedriver.storage.googleapis.com/
i 「wdm」: Compiled with warnings.
[11:20:59] I/downloader - curl -oC:\_VSTS\OkhamaMD\OkhamaMDWebDemo\UI\node_modules\protractor\node_modules\webdriver-manager\selenium/chromedriver_2.46.zip https://chromedriver.storage.googleapis.com/2.46/chromedriver_win32.zip
[11:20:59] I/update - chromedriver: unzipping chromedriver_2.46.zip
[11:21:00] I/launcher - Running 1 instances of WebDriver
[11:21:00] I/direct - Using ChromeDriver directly...

DevTools listening on ws://127.0.0.1:59746/devtools/browser/8a7f04ec-5be2-40bb-b68f-463b377c9c2b
[11:21:01] E/launcher - session not created: Chrome version must be between 71 and 75
  (Driver info: chromedriver=2.46.628402 (536cd7adbad73a3783fdc2cab92ab2ba7ec361e1),platform=Windows NT 10.0.17763 x86_64)
[11:21:01] E/launcher - SessionNotCreatedError: session not created: Chrome version must be between 71 and 75
  (Driver info: chromedriver=2.46.628402 (536cd7adbad73a3783fdc2cab92ab2ba7ec361e1),platform=Windows NT 10.0.17763 x86_64)
    at Object.checkLegacyResponse (C:\_VSTS\OkhamaMD\OkhamaMDWebDemo\UI\node_modules\selenium-webdriver\lib\error.js:546:15)
    at parseHttpResponse (C:\_VSTS\OkhamaMD\OkhamaMDWebDemo\UI\node_modules\selenium-webdriver\lib\http.js:509:13)
    at doSend.then.response (C:\_VSTS\OkhamaMD\OkhamaMDWebDemo\UI\node_modules\selenium-webdriver\lib\http.js:441:30)
    at process._tickCallback (internal/process/next_tick.js:68:7)
From: Task: WebDriver.createSession()
    at Function.createSession (C:\_VSTS\OkhamaMD\OkhamaMDWebDemo\UI\node_modules\selenium-webdriver\lib\webdriver.js:769:24)
    at Function.createSession (C:\_VSTS\OkhamaMD\OkhamaMDWebDemo\UI\node_modules\selenium-webdriver\chrome.js:761:15)
    at Direct.getNewDriver (C:\_VSTS\OkhamaMD\OkhamaMDWebDemo\UI\node_modules\protractor\built\driverProviders\direct.js:77:33)
    at Runner.createBrowser (C:\_VSTS\OkhamaMD\OkhamaMDWebDemo\UI\node_modules\protractor\built\runner.js:195:43)
    at q.then.then (C:\_VSTS\OkhamaMD\OkhamaMDWebDemo\UI\node_modules\protractor\built\runner.js:339:29)
    at _fulfilled (C:\_VSTS\OkhamaMD\OkhamaMDWebDemo\UI\node_modules\q\q.js:834:54)
    at C:\_VSTS\OkhamaMD\OkhamaMDWebDemo\UI\node_modules\q\q.js:863:30
    at Promise.promise.promiseDispatch (C:\_VSTS\OkhamaMD\OkhamaMDWebDemo\UI\node_modules\q\q.js:796:13)
    at C:\_VSTS\OkhamaMD\OkhamaMDWebDemo\UI\node_modules\q\q.js:556:49
    at runSingle (C:\_VSTS\OkhamaMD\OkhamaMDWebDemo\UI\node_modules\q\q.js:137:13)
[11:21:01] E/launcher - Process exited with error code 199
An unexpected error occurred: undefined

1 个答案:

答案 0 :(得分:6)

那是因为您指出了Chrome version: Version 76.0.3809.132
可以通过更新webdriver-manager和量角器轻松解决此问题:

npm install -g webdriver-manager protractor && webdriver-manager update

如果这不起作用,请先尝试将其卸载,然后重新安装最新版本:

npm uninstall -g webdriver-manager protractor

然后

npm install -g webdriver-manager protractorwebdriver-manager update