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

WebDriverManager does not detect chromedriver if installed as snap #795

Closed
jensbac opened this issue Feb 26, 2022 · 2 comments
Closed

WebDriverManager does not detect chromedriver if installed as snap #795

jensbac opened this issue Feb 26, 2022 · 2 comments
Labels

Comments

@jensbac
Copy link
Contributor

jensbac commented Feb 26, 2022

I'm using webdrivermanager 5.1.0 on Ubuntu 20.04 with chromedriver (for chromium) installed via snap having almost the same problem as described in #403.

The snap installation is simply not detected and a chromedriver gets downloaded, which - of course - cannot work with the snap installed chromium.

I debugged for several hours and found out the reason why:

  • WebDriverManager has a field named versionDetector. Which is read by WebDriverManager.getVersionDetector() but never assigned.
  • During processing of WebDriverManager.setup(), WebDriverManager.getVersionDetector() gets called at least two times - returning a new VersionDetector each.
  • The first VersionDetector used within WebDriverManager.getBrowserVersionFromTheShell() - in my case - detects the chromedriver to be a snap and sets its isSnap flag, but nobody cares about this.
  • Later on WebDriverManager.manage() calls WebDriverManager.getVersionDetector() a second time and receives a virgin VersionDetector which has no knowledge about the first ones findings.

The same pattern as with WebDriverManager.getVersionDetector() applies to the fields resolutionCache and webDriverCreator with their WebDriverManager.getResolutionCache() and WebDriverManager.getWebDriverCreator() methods - fields are read but never assigned, getters return new instances with each call.

I do not know the real intention of this implementation - additional with respect to the three fields have protected access - but for me the current beaviour seems to be unintentional.

I'll try to setup a pull request within the next days which fixes at least the behaviour of versionDetector and WebDriverManager.getVersionDetector().

@jensbac
Copy link
Contributor Author

jensbac commented Feb 27, 2022

The issue is quite new - was introduced by refactoring with commit 048f735.

jensbac added a commit to jensbac/webdrivermanager that referenced this issue Feb 27, 2022
bonigarcia added a commit that referenced this issue Mar 1, 2022
[#795] Fixed lazy instantiation for some fields of `WebDriverManager`
@bonigarcia
Copy link
Owner

Thanks a lot for reporting and contributing. #796 is merged now.

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

2 participants