更新到 ChromeDriver 2.46 后 Chrome 版本必须介于 71 和 75

将 chromedriver 更新到 2.46 版后,我的 tats 无法初始化。我收到这样的消息:


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'

很明显,我的浏览器版本无效。但我使用的是 Chrome 72.0.3626.119,所以它介于 71 和 75 之间。Selenium 版本是 2.53.1。我在 testNG 的帮助下通过控制台命令运行测试。


任何想法?我发现的每个想法都是关于更改 selenium 版本,但我做不到。


慕田峪9158850
浏览 297回答 3
3回答

德玛西亚99

让我解决这个问题:在 Windows 上cd C:\Users\[myname]\AppData\Roaming\npm\node_modules\protractornpm i webdriver-manager@latestwebdriver-manager updatewebdriver-manager start &在 Cent-OS 上(我使用了 Cent-OS 7.4.*,它运行良好。)cd /usr/lib/node_modules/protractor/sudo npm i webdriver-manager@latestsudo webdriver-manager updatesudo webdriver-manager start &我希望这对你有任何帮助。

ibeautiful

此错误消息...Starting ChromeDriver 2.46.628402 (536cd7adbad73a3783fdc2cab92ab2ba7ec361e1) on port 44269Only 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...暗示ChromeDriver v2.46与您的程序/网络驱动程序正在访问的Chrome 浏览器版本不兼容。您的主要问题是您使用的二进制文件版本之间的不兼容,如下所示:您正在使用chromedriver=2.46chromedriver=2.46的发行说明清楚地提到了以下内容:支持Chrome v71-73尽管您提到您使用的是Chrome 72.0.3626.119 ,但您的系统中可能安装了多个Chrome 浏览器实例,并且您的程序默认访问的Chrome 浏览器版本不在v71.x和v75.x您正在使用chrome=67.0ChromeDriver v2.38的发行说明清楚地提到了以下内容:支持Chrome v65-67解决方案保持JDK升级到最新级别JDK 8u201。卸载Chrome 浏览器的所有实例(您可以选择使用Revo Uninstaller)。将ChromeDriver升级到当前的ChromeDriver v2.46级别。将Chrome版本保持在Chrome v71-73级别之间。(根据 ChromeDriver v2.46 发行说明)

qq_花开花谢_0

在我的情况下,在我的 chrome 更新到版本 76 后,我遇到了同样的错误。这是在chimp尝试使用chromedriver执行 selenium 测试时发生的。DevTools listening on ws://127.0.0.1:49220/devtools/browser/e88586cb-ed67-44fc-a742-43b767e2b8f9&nbsp; &nbsp; [chimp][helper] setupBrowserAndDDP had error&nbsp; &nbsp; { Error: session not created: Chrome version must be between 71 and 75&nbsp; &nbsp; &nbsp; &nbsp; at Object.wait (C:\ACPMS\ELS_AT\node_modules\fibers\future.js:449:15)&nbsp; &nbsp; &nbsp; &nbsp; at Object.<anonymous> (C:\ACPMS\ELS_AT\node_modules\wdio-sync\build\index.js:344:27)&nbsp; &nbsp; &nbsp; &nbsp; at Object.<anonymous> (C:\ACPMS\ELS_AT\node_modules\chimp\dist\lib\session-manager.js:145:21)&nbsp; &nbsp; &nbsp; &nbsp; at initBrowser (C:\ACPMS\ELS_AT\node_modules\chimp\dist\lib\chimp-helper.js:189:43)&nbsp; &nbsp; &nbsp; &nbsp; at Object.setupBrowserAndDDP (C:\ACPMS\ELS_AT\node_modules\chimp\dist\lib\chimp-helper.js:264:7)&nbsp; &nbsp; &nbsp; &nbsp; at Context.<anonymous> (C:\ACPMS\ELS_AT\node_modules\chimp\dist\lib\mocha\mocha-helper.js:13:15)&nbsp; &nbsp; &nbsp; &nbsp; at C:\ACPMS\ELS_AT\node_modules\chimp\dist\lib\utils\fiberize.js:29:22&nbsp; &nbsp; &nbsp; &nbsp; (Driver info: chromedriver=2.46.628402 (536cd7adbad73a3783fdc2cab92ab2ba7ec361e1),platform=Windows NT 10.0.17134 x86_64)&nbsp; &nbsp; &nbsp; &nbsp; at new RuntimeError (C:\ACPMS\ELS_AT\node_modules\webdriverio\build\lib\utils\ErrorHandler.js:143:12)&nbsp; &nbsp; &nbsp; &nbsp; at Request._callback (C:\ACPMS\ELS_AT\node_modules\webdriverio\build\lib\utils\RequestHandler.js:318:39)&nbsp; &nbsp; &nbsp; &nbsp; at Request.self.callback (C:\ACPMS\ELS_AT\node_modules\request\request.js:185:22)&nbsp; &nbsp; &nbsp; &nbsp; at emitTwo (events.js:106:13)&nbsp; &nbsp; &nbsp; &nbsp; at Request.emit (events.js:191:7)&nbsp; &nbsp; &nbsp; &nbsp; at Request.<anonymous> (C:\ACPMS\ELS_AT\node_modules\request\request.js:1161:10)&nbsp; &nbsp; &nbsp; &nbsp; at emitOne (events.js:96:13)&nbsp; &nbsp; &nbsp; &nbsp; at Request.emit (events.js:188:7)&nbsp; &nbsp; &nbsp; &nbsp; at IncomingMessage.<anonymous>对我来说,当我通过 npm(全局和本地)更新 chrome 驱动程序时它不起作用,然后我按照以下步骤解决问题,这可能会提供一些关于在哪里检查此类问题的想法:因为引发了异常,所以node_modules\chimp\dist\lib\utils\fiberize.js我导航到该文件并在该文件上方找到了node_modules\chimp\dist\lib\chromedriver.js具有启动 chromedriver 的代码的级别。我在 chromedriverPath 中添加了一个 console.log,如下所示,并重新执行了测试以在控制台日志中获取 chromedriver 路径。&nbsp; &nbsp; Chromedriver.prototype.start = 函数(回调){&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 变种自我=这个;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; var 端口 = self.options.port;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 如果(this.child){&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 打回来();&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 返回;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; var chromedriverPath = chromedriver.path;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //这是我添加的,看到 chrome 驱动器路径&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; console.log("[黑猩猩] " + chromedriverPath);&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 如果(fs.existsSync(chromedriverPath)){&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; this.child = processHelper.start(&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; bin: chromedriverPath,&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 前缀:“chromedriver”,&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 参数:["--port=" + 端口,"--url-base=wd/hub"],&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; waitForMessage: /Starting ChromeDriver/,&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 错误消息:/错误/&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; },&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 打回来&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; );&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; } 别的 {&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; callback("[chimp][chromedriver] Chromedriver 可执行文件未找到。");&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }&nbsp; &nbsp; &nbsp; &nbsp; };当我获得用于执行测试的 chromedriver 的路径时,我只是导航到该文件夹并将chromedriver可执行文件替换为最新版本。我希望这有帮助。
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

Java