Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Selenium use Chromium instead of google-chrome

I first installed Chromium and prepared my Selenium tests to run with it (I have the chromeDriver and I did create the symbolic link google-chrome pointing to chromium-browser). Everything was running smooth.

Later I did install the google-chrome browser to debug some node.js application and since then Selenium opens Google Chrome instead of Chromium.

I can not figure out how to get back selenium opening Chromium. The synmbolic link does exist and points to chromium-browser.

How to run Selenium with Chromium when google-chrome is also available on the system?

UPDATE 1: what about update-alternatives ?

$ ls -lah /usr/bin/google-chrome
/usr/bin/google-chrome -> /etc/alternatives/google-chrome

$ ls -lah /etc/alternatives/google-chrome
/etc/alternatives/google-chrome -> /usr/lib/chromium-browser/chromium-browser
like image 749
PauloASilva Avatar asked Jul 28 '14 16:07

PauloASilva


People also ask

Can I use Chromium with Selenium?

Through WebDriver, Selenium supports all major browsers on the market such as Chrome/Chromium, Firefox, Internet Explorer, Edge, and Safari. Where possible, WebDriver drives the browser using the browser's built-in support for automation.

Should I use Chromium instead of Chrome?

One major difference between the two is that Google Chrome updates automatically, where Chromium does not. This can be a disadvantage when it comes to the Chromium browser vs Chrome angle of the battle. Specifically, because Chromium comes with a lot of updates.

Do you need Chrome installed for Selenium?

Yes you do need a full-install of the browser, for example see the Selenium docs for Chrome " The server expects you to have Chrome installed in the default location for each system... " src: github.com/SeleniumHQ/selenium/wiki/ChromeDriver.

Can Selenium use existing browser?

New Selenium IDEWe can interact with an existing browser session. This is performed by using the Capabilities and ChromeOptions classes. The Capabilities class obtains the browser capabilities with the help of the getCapabilities method.


1 Answers

From these docs: "For Linux systems, the ChromeDriver expects /usr/bin/google-chrome to be a symlink to the actual Chrome binary. See also the section on overriding the Chrome binary location ." Unfortunately that section does not appear to exist on that page but I think I found it elsewhere: executing in a non-standard location, so that's the way to go:

ChromeOptions options = new ChromeOptions();
options.setBinary("/path/to/other/chrome/binary");
like image 97
Jmills Avatar answered Sep 19 '22 18:09

Jmills