将chromedriver更新至2.46版后,我的商品无法初始化。 我收到这样的消息:
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之间。 硒版本为2.53.1。 我正在testNG的帮助下通过控制台命令运行测试。
有什么主意吗?我发现的每个想法都与更改硒版本有关,但我做不到。
答案 0 :(得分:9)
我要解决此问题:
在Windows上
/**
* Trigger when someone releases a key on the field where you can post remarks, posts or reactions
*/
$(document).on("keyup", ".post-input-field", function (event) {
// if the user has pressed the spacebar (32) or the enter key (13)
if (event.keyCode === 32 || event.keyCode === 13) {
currentCommentText = currentCommentText.replace(/#(\w+)/g, "<a class='hashtag' href=" + url + " target='_blank'>$&</a> ").replace("<br>", ""); //replace hashtags with a link
textField.html(currentCommentText);
}
});
在Cent-OS上(我使用的是Cent-OS 7.4。*,它工作正常。)
cd C:\Users\[myname]\AppData\Roaming\npm\node_modules\protractor
npm i webdriver-manager@latest
webdriver-manager update
webdriver-manager start &
希望这对您有帮助。
答案 1 :(得分:2)
此错误消息...
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
...表示 ChromeDriver v2.46 与您的程序/网络驱动程序正在访问的 Chrome浏览器版本不兼容。
您的主要问题是所使用的二进制版本之间的不兼容性:
尽管您提到您正在使用 Chrome 72.0.3626.119 ,但系统中可能安装了多个 Chrome浏览器实例,并且您的程序默认访问 Chrome浏览器,其版本不在 v71.x
和 v75.x
您正在使用 chrome = 67.0
答案 2 :(得分:1)
对我来说,我必须在项目中更新chrome驱动程序以匹配本地计算机上的Chrome版本。
纱线添加chromedriver@76.0.0 -D
答案 3 :(得分:0)
在我的情况下,我将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>
对我来说,当我通过npm(全球和本地)更新chrome驱动程序时,它不起作用,然后我按照以下步骤解决了该问题,这可能使您对在何处检查此类问题有所了解:
node_modules\chimp\dist\lib\utils\fiberize.js
中引发了异常,所以我导航到该文件,并在该文件node_modules\chimp\dist\lib\chromedriver.js
之上找到了一个具有启动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."); } };
chromedriver
可执行文件。我希望这会有所帮助。
答案 4 :(得分:0)
尝试以下操作:下载兼容版本的ChromeDriver.exe文件,以获取更新版本的Chrome浏览器并替换它。它对我有用。