19
votes

After update of chromedriver to version 2.46 my tasts fail to initialize. I got message like this:

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'

It is clearly saying that my browser version is not valid. But I am using Chrome 72.0.3626.119 so it is between 71 and 75. Selenium version is 2.53.1. And I am running test through console command with the help of testNG.

Any idea? Every ideas that I found was about changing selenium version but I cant do it.

5
Well, it may be that another Chrome version exists on that machine and is used. For example, chromedriver also checks C:\Users\<username>\AppData\Local\Google\Chrome\Application for a chrome.exe. Make sure that there really is no old chrome version on your machine - e.g. search for all chrome.exe on all hard disks.Florian Albrecht
@FlorianAlbrecht Well it might be it. I need to check if there is some not removed application before running testsSuule
you need to upgrade selenium.. version 2.53 is not compatible with latest versions of chromedriverCorey Goldberg

5 Answers

5
votes

This error message...

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

...implies that the ChromeDriver v2.46 is not compatible with the Chrome Browser version which is being accessed by your program/webdriver.

Your main issue is the incompatibility between the version of the binaries you are using as follows:

  • You are using chromedriver=2.46
  • Release Notes of chromedriver=2.46 clearly mentions the following :

Supports Chrome v71-73

  • Though you mentioned you are using Chrome 72.0.3626.119 possibly there are multiple instances of Chrome Browser installed within your system and your program by default is accessing the Chrome Browser whose version is not between v71.x and v75.x

  • You are using chrome=67.0

  • Release Notes of ChromeDriver v2.38 clearly mentions the following :

Supports Chrome v65-67


Solution

12
votes

For me to resolve this problem :

On Windows

cd C:\Users\[myname]\AppData\Roaming\npm\node_modules\protractor
npm i webdriver-manager@latest
webdriver-manager update
webdriver-manager start &

On Cent-OS (I used Cent-OS 7.4.* and it worked fine.)

cd /usr/lib/node_modules/protractor/
sudo npm i webdriver-manager@latest
sudo webdriver-manager update
sudo webdriver-manager start &

I hope this helps you in any way.

1
votes

For me, I had to update my chrome driver in my project to match the version of Chrome on my local machine.

yarn add [email protected] -D

https://www.npmjs.com/package/chromedriver

1
votes

In my case I was getting the same error after my chrome was updated to version 76. Which was happening when chimp tries to use chromedriver to execute the selenium test.

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>

For me it didn't work when I updated the chrome driver by npm (both globally and locally) and then I followed these steps to resolve the issue, which might give some idea on where to check in this kind a issue:

  1. Because exception was thrown in node_modules\chimp\dist\lib\utils\fiberize.js i navigated to that file and found one level above this file node_modules\chimp\dist\lib\chromedriver.js which has the code to start chromedriver.
  2. I added a console.log to chromedriverPath which can be seen below and re-executed the tests to get the chromedriver path in console logs.

    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.");
          }
        };
  1. When i got the path of the chromedriver which is used to execute the tests, i just navigated to that folder and replaced chromedriver executable with the most recent version.

I hope this helps.

0
votes

Try this: Download the compatible ChromeDriver.exe file for the updated version of Chrome browser and replace it. It works for me.