Skip to content

Workaround for wrong chromedriver version #353

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
carlos-gva opened this issue Mar 27, 2019 · 27 comments
Closed

Workaround for wrong chromedriver version #353

carlos-gva opened this issue Mar 27, 2019 · 27 comments

Comments

@carlos-gva
Copy link

I noticed that when using the webdriver-manager update command it downloads the Chromedriver v74.x.x and it only runs with the Chrome v74, which I don't have on my machine yet because the latest Chrome stable version is v73.

So, this stopped working...

Why this started to download and apply this chromedriver versions?

@21stChannel
Copy link

Same issue here. I now force the job to use a static version (2.46) as workaround, but it's not ideal.

@r1b
Copy link

r1b commented Mar 28, 2019

Is there an implicit assumption here that Google will not publish a beta version of chromedriver to this list [1]? If this assumption is reality, I think this is on Google. webdriver-manager simply grabs the latest version from that list [2].

[1] https://chromedriver.storage.googleapis.com/
[2] https://github.com/angular/webdriver-manager/blob/master/lib/provider/utils/version_list.ts#L57-L74

@21stChannel
Copy link

Is there an implicit assumption here that Google will not publish a beta version of chromedriver to this list [1]? If this assumption is reality, I think this is on Google. webdriver-manager simply grabs the latest version from that list [2].

[1] https://chromedriver.storage.googleapis.com/
[2] https://github.com/angular/webdriver-manager/blob/master/lib/provider/utils/version_list.ts#L57-L74

Here are some observations:

  1. Protractor 6.0.0 comes with webdriver-manager 13.0.0, webdriver-manager 13.0.0 grabs the beta chromedriver.
  2. Protractor 5.4.2 comes with webdriver-manager 12.1.1, and v12.1.1 grabs chromedriver 2.46, which is the version works with stable Chrome.

I suspect the protractor 6.0.0 and webdriver-manager 13.0.0 both have some issues.

@rajarshi-singh
Copy link

@21stChannel Thanks for update, I was able to do the same ugly workaround to unblock my integration with Protractor 6.0:

webdriver-manager update --versions.chrome=2.46

@cnishina
Copy link
Contributor

So the intent was to always download the latest. This was the case in the previous webdriver-manager. It only downloaded the latest 2.xx version because of a regex error. After two years of this being the case, it appears ChromeDriver released something that does not align with Chrome.

Anyway, we were discussing a new feature prior to the ChromeDriver-gate issue we are seeing. We were proposing to

  • Download Chromium and ChromeDriver together. Pinning the version via only major version. So if you want 73, it will download the latest 73 ChromeDriver and Chromium
  • Query the Chrome version you have installed and try to download a matching ChromeDriver. I'm not sure if this is valid since Chrome might not be installed in a typical location and also the command line might not be exposed to get the version.

Yes the workaround is to pin the version for chromedriver. I had to do this for the Protractor repo. This is unfortunately the solution / workaround for now until Chrome 74 is released.

@cnishina cnishina changed the title Wrong chromedriver version Workaround for wrong chromedriver version Mar 29, 2019
@cnishina
Copy link
Contributor

Speaking of getting things to work, I tagged the latest Protractor to 5.4.2 since that version is pretty stable. That means, webdriver-manager will be at version 12-something. Maybe Chrome 74 will drop when I get these fixes in.

@carlos-gva
Copy link
Author

I also did that workaround to pin the ChromeDriver v73 to be downloaded.

thanks @cnishina for the update 🙂

@cnishina
Copy link
Contributor

cnishina commented Apr 1, 2019

Maybe we can add something to the readme file? I think this could be helpful since it is maybe something that could be fixed in the future but I don't think there is bandwidth right now to take this on. @carlos-gva would you mind updating the README?

@carlos-gva
Copy link
Author

@cnishina done.

@cnishina
Copy link
Contributor

cnishina commented Apr 4, 2019

Adding some additional information about why webdriver-manager is doing what its doing:

From webdriver-manager's point of view, we would have to know the version of Chrome on the current working machine. I'm not 100% sure how to get this information from each machine programatically.

@carlos-gva
Copy link
Author

Getting this info from each machine seems to be really tricky and probably does not deserve that effort.

@ststroppel
Copy link

An additional issue is that protractor 5.4.2 only works with webdriver-manager 12.1.1 and not with version 13.0.0. For this, you can only use chromedriver up to version 2.46, which only provides support for Chrome v71-73. This means, as soon as Chrome v74 is released, you cannot work with the latest Chrome version anymore using protractor 5.4.2.
This will then require everyone to migrate already to protractor 6, which with all the breaking changes might be some effort.

cnishina added a commit to cnishina/webdriver-manager that referenced this issue Apr 24, 2019
- Do a version match based on string startsWith of the maxVersion
  An example:

  Matching "0.1" might find versions 0.14.0, 0.151.0, 0.1.0. It will then
  get the max version which is 0.151. If a user wanted to get 0.1, then
  they could specify version "0.1."

- Fix / update interchangable aliases:
  - selenium == standalone
  - chromedriver == chrome
  - geckodriver == gecko
  - iedriver = ie

Tagging angular#280, angular#358, angular#353. Additional work is still required to have a
config file that has this information instead of hard coding it.
cnishina added a commit to cnishina/webdriver-manager that referenced this issue Apr 24, 2019
- Do a version match based on string startsWith of the maxVersion
  An example:

  Matching "0.1" might find versions 0.14.0, 0.151.0, 0.1.0. It will then
  get the max version which is 0.151. If a user wanted to get 0.1, then
  they could specify version "0.1."

- Fix / update interchangable aliases:
  - selenium == standalone
  - chromedriver == chrome
  - geckodriver == gecko
  - iedriver = ie

Tagging angular#280, angular#358, angular#353. Additional work is still required to have a
config file that has this information instead of hard coding it.
cnishina added a commit to cnishina/webdriver-manager that referenced this issue Apr 24, 2019
- Do a version match based on string startsWith of the maxVersion
  An example:

  Matching "0.1" might find versions 0.14.0, 0.151.0, 0.1.0. It will then
  get the max version which is 0.151. If a user wanted to get 0.1, then
  they could specify version "0.1."

- Fix / update interchangable aliases:
  - selenium == standalone
  - chromedriver == chrome
  - geckodriver == gecko
  - iedriver = ie

Tagging angular#280, angular#358, angular#353. Additional work is still required to have a
config file that has this information instead of hard coding it.
cnishina added a commit to cnishina/webdriver-manager that referenced this issue Apr 24, 2019
- Do a version match based on string startsWith of the maxVersion
  An example:

  Matching "0.1" might find versions 0.14.0, 0.151.0, 0.1.0. It will then
  get the max version which is 0.151. If a user wanted to get 0.1, then
  they could specify version "0.1."
- Added a unit test to the version_list to find max versions.

- Fix / update interchangable aliases:
  - selenium == standalone
  - chromedriver == chrome
  - geckodriver == gecko
  - iedriver = ie

Tagging angular#280, angular#358, angular#353. Additional work is still required to have a
config file that has this information instead of hard coding it.
cnishina added a commit to cnishina/webdriver-manager that referenced this issue Apr 24, 2019
- Do a version match based on string startsWith of the maxVersion
  An example:

  Matching "0.1" might find versions 0.14.0, 0.151.0, 0.1.0. It will then
  get the max version which is 0.151. If a user wanted to get 0.1, then
  they could specify version "0.1."
- Added a unit test to the version_list to find max versions.

- Fix / update interchangable aliases:
  - selenium == standalone
  - chromedriver == chrome
  - geckodriver == gecko
  - iedriver = ie

Tagging angular#280, angular#358, angular#353. Additional work is still required to have a
config file that has this information instead of hard coding it.
cnishina added a commit to cnishina/webdriver-manager that referenced this issue Apr 24, 2019
- Do a version match based on string startsWith of the maxVersion
  An example:

  Matching "0.1" might find versions 0.14.0, 0.151.0, 0.1.0. It will then
  get the max version which is 0.151. If a user wanted to get 0.1, then
  they could specify version "0.1."
- Added a unit test to the version_list to find max versions.

- Fix / update interchangable aliases:
  - selenium == standalone
  - chromedriver == chrome
  - geckodriver == gecko
  - iedriver = ie

Tagging angular#280, angular#358, angular#353. Additional work is still required to have a
config file that has this information instead of hard coding it.
@barbara
Copy link

barbara commented Apr 25, 2019

Hi all,
So Chrome has released its version 74 yesterday and I downloaded it (shouldn't have). When I launch protractor I can see that the correct version of Chromedriver (74) and selenium (4.0.0) are downloaded but I'm now getting an error when starting selenium.

[15:18:40] I/local - Starting selenium standalone server...
[15:18:42] I/local - Selenium standalone server started at http://10.190.104.142:4444/wd/hub
[15:18:48] E/launcher - Error: WebDriverError: Host header or origin header is specified and is not localhost.
at parseHttpResponse (/Users/biberli/.nvm/v8.11.3/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/http.js:559:11)
at Executor.execute (/Users/biberli/.nvm/v8.11.3/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/http.js:468:26)
at
at process._tickCallback (internal/process/next_tick.js:188:7)
[15:18:48] E/launcher - Process exited with error code 100
make: *** [test] Error 100

Any idea what could cause this?

@vadeneev
Copy link

vadeneev commented Apr 25, 2019

An additional issue is that protractor 5.4.2 only works with webdriver-manager 12.1.1 and not with version 13.0.0. For this, you can only use chromedriver up to version 2.46, which only provides support for Chrome v71-73. This means, as soon as Chrome v74 is released, you cannot work with the latest Chrome version anymore using protractor 5.4.2.
This will then require everyone to migrate already to protractor 6, which with all the breaking changes might be some effort.

Is that information correct ?
I believe 12.1.1 should work with 2.47 and other as well.

However, right now i can see that 2.47 is available, but 12.1.1 doesn't download it

@santiago-pan
Copy link

Same here:

16:27:31] I/launcher - Running 1 instances of WebDriver
[16:27:31] I/local - Starting selenium standalone server...
[16:27:31] E/launcher - Error: Error: Server terminated early with status 1
    at earlyTermination.catch.e (/.../node_modules/selenium-webdriver/remote/index.js:252:52)
    at process._tickCallback (internal/process/next_tick.js:68:7)
[16:27:31] E/launcher - Process exited with error code 100

@barbara
Copy link

barbara commented Apr 29, 2019

So has anyone downloaded the latest Chrome version 74.0.3729.108 and is anyone facing the same issue? I'm at a loss as to what to do with this error:

Error: WebDriverError: Host header or origin header is specified and is not localhost.

@santiago-pan
Copy link

santiago-pan commented Apr 29, 2019

In my case when running:

webdriver-manager update --versions.chrome=2.46

It was downloading:

selenium-server-standalone-4.0.0-alpha-1.zip.jar

instead of:

selenium-server-standalone-3.141.59.jar

The issue is fixed using:

webdriver-manager 12.1.2

Instead of:

webdriver-manager 12.1.1

@cnishina
Copy link
Contributor

cnishina commented May 2, 2019

@santiago-pan Yes that is true. The latest fix is 12.1.4 which fixes the downloading for chromedriver
@barbara Could you open a bug with more info? Please provide as much info as possible to help repro this. A bug might need to be filed against ChromeDriver.

@barbara
Copy link

barbara commented May 3, 2019

@cnishina thanks a lot for looking into this. I finally managed to make it work again by downgrading to protractor 5.4.2, but here's how it looked:

  • I was running protractor 6.0.0 which was downloading
  • selenium-server-standalone-4.0.0-alpha-1.jar and
  • Chromedriver 74.0.3729.6 for mac (chromedriver_mac64.zip)
  • My Chrome browser was running v.74.0.3729.108
  • Not much in my protractor config file; I'd set the selenium port to null and same for the selenium address so that protractor would start its own server.
  • My selenium promise manager was set to false as I've switched to ES2017 async/await.

This is the error I was getting:

[15:18:40] I/local - Starting selenium standalone server...
[15:18:42] I/local - Selenium standalone server started at http://10.190.104.142:4444/wd/hub
[15:18:48] E/launcher - Error: WebDriverError: Host header or origin header is specified and is not localhost.
at parseHttpResponse (/Users/biberli/.nvm/v8.11.3/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/http.js:559:11)
at Executor.execute (/Users/biberli/.nvm/v8.11.3/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/http.js:468:26)
at 
at process._tickCallback (internal/process/next_tick.js:188:7)
[15:18:48] E/launcher - Process exited with error code 100
make: *** [test] Error 100

Now that I downgraded protractor it works fine as it downloads Chromedriver_2.46 and selenium standalone server 3.141.59.

@whenlit
Copy link

whenlit commented May 3, 2019

@barbara Hi, I had the same problem and this worked for me. In protractor.conf, use:

exports.config = {
    (...)
    localSeleniumStandaloneOpts: {
        loopback: true
    }
}

@barbara
Copy link

barbara commented May 10, 2019

@cnishina so I wanted to upgrade again protractor to version 6.0.0 and test @whenlit fix, but it's the same issue all over again: Chromedriver v75 is out and only works with Chrome v75 which is not out yet. So the only way is to downgrade?

@whenlit
Copy link

whenlit commented May 10, 2019

@barbara Well... you can of course choose the version of chromedriver by specifiying versions.chrome in webdriver-update... but it doesn't take "74", you have to specify the exact version, which you can get from google using (in this case) https://chromedriver.storage.googleapis.com/LATEST_RELEASE_74 (as explained here. Apparently, you can get your version of chrome with google-chrome --version in unix-type environments, or with wmic datafile where name="C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe" get Version /value in Windows.

@whenlit
Copy link

whenlit commented May 10, 2019

@barbara Unfortunately, if you want to run in parallel, there's a bug in multiCapabilities that prevents you from doing so in 6.0.0. This is currently preventing me from upgrading :(

@smt9020
Copy link

smt9020 commented May 10, 2019

Has anyone had this issue using the selenium grid and not protractor? I am getting the same thing "Host header or origin header is specified and is not localhost." and using:

  • selenium-server-standalone-4.0.0-alpha-1.jar and
  • Chromedriver 74.0.3729.6 for mac (chromedriver_mac64.zip)
  • My Chrome browser was running v.74.0.3729.108

I don't understand where to put this loopback property if I am not using protractor.

@whenlit
Copy link

whenlit commented May 14, 2019

@smt9020 If I understand correctly, chromedriver only allows localhost or ip addresses. So something like this may work: java -jar selenium-server-standalone-4.0.0-alpha-1.jar -host 192.XXX.X.XX -role hub.

cnishina added a commit to cnishina/webdriver-manager that referenced this issue Jun 6, 2019
- Do a version match based on string startsWith of the maxVersion
  An example:

  Matching "0.1" might find versions 0.14.0, 0.151.0, 0.1.0. It will then
  get the max version which is 0.151. If a user wanted to get 0.1, then
  they could specify version "0.1."
- Added a unit test to the version_list to find max versions.

- Fix / update interchangable aliases:
  - selenium == standalone
  - chromedriver == chrome
  - geckodriver == gecko
  - iedriver = ie

Tagging angular#280, angular#358, angular#353. Additional work is still required to have a
config file that has this information instead of hard coding it.
cnishina added a commit that referenced this issue Jun 6, 2019
- Do a version match based on string startsWith of the maxVersion
  An example:

  Matching "0.1" might find versions 0.14.0, 0.151.0, 0.1.0. It will then
  get the max version which is 0.151. If a user wanted to get 0.1, then
  they could specify version "0.1."
- Added a unit test to the version_list to find max versions.

- Fix / update interchangable aliases:
  - selenium == standalone
  - chromedriver == chrome
  - geckodriver == gecko
  - iedriver = ie

Tagging #280, #358, #353. Additional work is still required to have a
config file that has this information instead of hard coding it.
@cnishina
Copy link
Contributor

cnishina commented Jun 6, 2019

Closed with #369

This has now been addressed for both legacy and master branches

@cnishina cnishina closed this as completed Jun 6, 2019
@Brunni
Copy link

Brunni commented Feb 25, 2020

I wrote a script which uses powershell to get the version of chrome which is installed. (Windows only)

Use at own risk of course:

import * as fs from 'fs';

const chromePath = 'C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe';
if (!fs.existsSync(chromePath)) {
    throw new Error(`Unable to find chrome executable for version detection under: ${chromePath}`);
}

const chromeVersion = child_process.execSync(`powershell.exe -command "(Get-item -Path '${chromePath}').VersionInfo.ProductVersion"`).toString();
console.log('Detected chrome version is: ', chromeVersion);

const opts = {} as any;
opts.stdio = 'inherit';
child_process.execSync(`webdriver-manager update  --versions.chrome=${chromeVersion}`, opts);```

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests