Skip to content
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

webdriver.chrome.binary is ignored #548

Closed
SiKing opened this issue Sep 8, 2020 · 16 comments
Closed

webdriver.chrome.binary is ignored #548

SiKing opened this issue Sep 8, 2020 · 16 comments
Labels

Comments

@SiKing
Copy link

SiKing commented Sep 8, 2020

Description of the problem:
When running my tests in CI, I want to use the latest (Chrome-Beta) browser. So I set the property:

webdriver.chrome.binary = /usr/bin/google-chrome-beta

Unfortunately, webdrivermanager ignores this and detects the previous version, from /usr/bin/google-chrome.

It would be desirable if webdrivermanager respected this property.

Browser and version:
All

Operating system:
All

WebDriverManager version:
4.1.0

WebDriverManager use:
I use the webdriver manager via Serenity-BDD https://github.com/serenity-bdd/serenity-core

@SiKing
Copy link
Author

SiKing commented Sep 8, 2020

I just tried setting:

wdm.browserPath = /usr/bin/google-chrome-beta

but I still get the wrong version of chromedriver.

@SiKing
Copy link
Author

SiKing commented Sep 8, 2020

As of this writing I am using:

+ google-chrome --version
Google Chrome 84.0.4147.135 
+ google-chrome-beta --version
Google Chrome 86.0.4240.22 beta

I would like to use version 86, but I always end up with:

WebDriverManager - Using chromedriver 84.0.4147.30 (since Chrome 84 is installed in your machine)

@SiKing
Copy link
Author

SiKing commented Sep 9, 2020

I had a browse through the source. Apparently wdm.browserPath is just that: a path. The name of the binary is hard-wired in the source to google-chrome.
A fix for this is not trivial.

@eliasnogueira
Copy link
Contributor

Can you try to set this as true @SiKing ?

wdm.useBetaVersions=true

@SiKing
Copy link
Author

SiKing commented Sep 14, 2020

I still get the same:

[INFO] WebDriverManager - Using chromedriver 84.0.4147.30 (since Chrome 84 is installed in your machine)

Do I need the wdm.browserPath in combination with above?

@eliasnogueira
Copy link
Contributor

Hi @SiKing I think you can try.
But I think you are writing in the comment said that the browser name is hardcoded.

If the wdm.browserPath and the wdm.useBetaVersions won't work I will try to change the chrome binary name when you set both.

@eliasnogueira
Copy link
Contributor

@SiKing I just realized that the wdm.browserPath was introduced into version 4.2.0, and your issue is with 4.1.0.
Can you update the library and try to do the test in the previous comment?

@SiKing
Copy link
Author

SiKing commented Sep 15, 2020

Finally got it to work! I need:

  • version 4.2; version 4.1 does not work
  • wdm.useBetaVersions=true

I did not use wdm.browserPath. That looks like it is only needed when the binary is not in the current path already?

@SiKing
Copy link
Author

SiKing commented Sep 16, 2020

I think I must be going crazy!

Last night I ran my full test suite: ~160 tests, running parallel across 4 threads. The first ~10 tests ran with version 86, as I was expecting. Then the remainder of the tests were run with version 84.

I do not understand how this is possible.

@SiKing SiKing reopened this Sep 16, 2020
@eliasnogueira
Copy link
Contributor

I will try to reproduce it locally.
Can you tell me if this environment is a headless one and how did you install the Chrome beta @SiKing ?

@SiKing
Copy link
Author

SiKing commented Sep 18, 2020

This is on Jenkins, so headless.
Our admin installed Chrome-Beta from an .rpm. It gets updated periodically (weekly) from a cron.

@bonigarcia
Copy link
Owner

bonigarcia commented Sep 21, 2020

The wdm.browserPath configuration key (or its equivalent method .browserPath()) should be enough to solve this issue. I have just committed an example of this: ChromeBetaTest

@SiKing Maybe your problem is that you are using Chrome and Chrome beta in the same test suite. Since WebDriverManager caches the found browser version, it can cause problems in this case. The solution should be using .clearResolutionCache() as well (in the tests using beta versions, for instance). But I have just discovered a bug in that method. I have committed another path to solve it. It should be available in the next version of wdm, to be released soon, stay tuned.

BTW the expected value of wdm.browserPath is not just a path, it is the full browser path. I have explained it better in the README.

@bonigarcia
Copy link
Owner

@SiKing Please update to WebDriverManager 4.2.1, just released and use .browserPath() and .clearResolutionCache() as in the example before. It should work.

@bonigarcia
Copy link
Owner

Or even better, use version 4.2.2 (former version has a bug related to Edge).

@SiKing
Copy link
Author

SiKing commented Sep 23, 2020

This now works.

I used version 4.2.2, and only wdm.browserPath. In my test suite I do not mix Chrome versions, so I did not use the clear cache thing.
Ran my entire test suite twice, just to be sure.

So just out of curiosity, what does wdm.useBetaVersions do?

@bonigarcia
Copy link
Owner

The configuration key wdm.useBetaVersions is used for beta versions in drivers (i.e. > stable). In this case, it should not be necessary since the wdm.browserPath is used to find the browser version, and with that, wdm can match the proper driver version (independently to the stable version).

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

No branches or pull requests

3 participants