How to Implement Chromedriver in Selenium in Linux Platform

Can somebody tell me how to use the Chrome driver in Selenium for Linux platform?

I have my chrome driver location at username/home/chromedriver.

My code is:

System.setProperty("webdriver.chrome.driver", "/home/username/ChromeDriver/chrome‌​driver");
driver = new ChromeDriver();
driver.get("facebook.com");

The error I am getting is:

org.openqa.selenium.WebDriverException: Unable to either launch or connect to Chrome. Please check that ChromeDriver is up-to-date.

Using Chrome binary at: /opt/google/chrome/google-chrome

(WARNING: The server did not provide any stacktrace information)

1

5 Answers

From [the official documentation](:

Requirements

The ChromeDriver controls the browser using Chrome's automation proxy framework.

The server expects you to have Chrome installed in the default location for each system:

OS          Expected Location of Chrome
-------------------------------------
Linux          /usr/bin/google-chrome
Mac            /Applications/Google\  Chrome
Windows XP     %HOMEPATH%\Local Settings\Application Data\Google\Chrome\Application\chrome.exe
Windows Vista  C:\Users\%USERNAME%\AppData\Local\Google\Chrome\Application\chrome.exe

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.

Elena Rostova

Elena Rostova

Lead Health, Wellness & Medical Journalist

Elena Rostova holds a Master's degree in Public Health Journalism. She covers groundbreaking medical research, holistic wellness trends, mental health awareness, and nutritional science.