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

Chromium as snap package (Ubuntu 19.10+) #403

Closed
michaelzangl opened this issue Nov 14, 2019 · 2 comments
Closed

Chromium as snap package (Ubuntu 19.10+) #403

michaelzangl opened this issue Nov 14, 2019 · 2 comments

Comments

@michaelzangl
Copy link

michaelzangl commented Nov 14, 2019

Description of the problem:
Webdriver does not find the chromedriver for the ubuntu snaps package.
The ubuntu snaps package for chromium (default starting with Ubuntu 19.10) requires a patched version of the webdriver. That version is / can be installed with chrome locally. The previous work around of forcing a chrome version does not work, since it will download the unpatched chromedriver.

The command to start chromium is:

chromium --version

If the version ends with snap, the driver to use is:

/snap/bin/chromium.chromedriver

It is important to use that binary and to not download it from anywhere else, since the snap sandboxing mechanism won't work when just downloading that binary.

Selenium currently has issues with this as well, so even if the auto-detection would work, the tests won't start. See SeleniumHQ/selenium#7788

Browser and version: Chromium 78.0.3904.97 snap

Operating system: Ubuntu 19.10

WebDriverManager version: 3.6.2
WebDriverManager use:

WebDriverManager.chromedriver().setup();
WebDriverManager.chromedriver().avoidAutoVersion().version(CHROME_VERSION).setup();

WebDriverManager traces:

2019-11-14 17:34:49,722                       [Test worker          ] DEBUG           io.github.bonigarcia.wdm.Shell – There was a problem executing command <google-chrome --version> on the shell: Cannot run program "google-chrome" (in directory "."): error=2, Datei oder Verzeichnis nicht gefunden
2019-11-14 17:34:49,722                       [Test worker          ] DEBUG o.github.bonigarcia.wdm.WebDriverManager – The proper chromedriver version for your Google Chrome is unknown ... trying with the latest
2019-11-14 17:34:50,130                       [Test worker          ] DEBUG o.github.bonigarcia.wdm.WebDriverManager – Latest version of chromedriver according to https://chromedriver.storage.googleapis.com/LATEST_RELEASE is 78.0.3904.70
2019-11-14 17:34:50,144                       [Test worker          ] INFO  o.github.bonigarcia.wdm.WebDriverManager – Reading https://chromedriver.storage.googleapis.com/ to seek chromedriver
2019-11-14 17:34:50,916                       [Test worker          ] INFO       io.github.bonigarcia.wdm.Downloader – Downloading https://chromedriver.storage.googleapis.com/78.0.3904.70/chromedriver_linux64.zip
2019-11-14 17:34:51,110                       [Test worker          ] INFO       io.github.bonigarcia.wdm.Downloader – Extracting binary from compressed file chromedriver_linux64.zip
2019-11-14 17:34:51,237                       [Test worker          ] INFO  o.github.bonigarcia.wdm.WebDriverManager – Exporting webdriver.chrome.driver as /home/mzangl/.m2/repository/webdriver/chromedriver/linux64/78.0.3904.70/chromedriver

Workaround

if (new File("/snap/bin/chromium.chromedriver").exists()) {
	System.setProperty("webdriver.chrome.driver", "/snap/bin/chromium.chromedriver");
} else {
		WebDriverManager.chromedriver().avoidAutoVersion().version(CHROME_VERSION).setup();
}
@bonigarcia
Copy link
Owner

Thanks for reporting. I'll take into account for the next version of wdm.

@bonigarcia
Copy link
Owner

WebDriverManager 3.8.0 provides support for Chromium (also for snap packages):

WebDriverManager.chromiumdriver().setup();

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

2 participants