Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to specify the Chrome binary location via the selenium server standalone command line?

I am using a portable version of Google Chrome that is not stored at the default location of my Windows 7 machine. I don't have admin rights to install Chrome at the default location.

Running java -jar selenium-server-standalone-2.52.0.jar -help does not hint any possibility of setting the path to the chrome binary (not the chrome driver).

The chrome driver capabilities indicate that it's possible to set the binary but I'm not sure how to do it via the command line.

like image 504
T. Junghans Avatar asked Mar 03 '16 15:03

T. Junghans


People also ask

How do I change the binary path in Chrome?

ChromeOptions optionsBeta = new ChromeOptions(); optionsBeta. setBinary(“path\\to\\chrome\\browser\\beta\\binary”); WebDriver driver = new ChromeDriver(optionsBeta);

Where is my Chrome binary located?

What is the exact path to the chrome binary on your PC? If you are working on Windows 10, it would be C:\Program Files (x86)\Google\Chrome\Application\chrome.exe .

How do I set a Chrome driver path?

Go to the terminal and type the command: sudo nano /etc/paths. Enter the password. At the bottom of the file, add the path of your ChromeDriver. Type Y to save.


1 Answers

You can specify a non-standard location for the chrome binary in ChromeOptions.

ChromeOptions options = new ChromeOptions();
options.setBinary("/path/to/other/chrome/binary");

See the ChromeOptions documentation at: https://sites.google.com/a/chromium.org/chromedriver/capabilities#TOC-Using-a-Chrome-executable-in-a-non-standard-location

like image 137
bobanahalf Avatar answered Sep 29 '22 10:09

bobanahalf