I need to install chromedriver
on Windows OS. In the article below they specify:
https://sites.google.com/a/chromium.org/chromedriver/getting-started
"...ChromeDriver expects you to have Chrome installed in the default location for your platform..."
But I'm not sure what is the default location ?
On Mac OS it's /usr/local/bin
.
With this I don't have to specify path explicitly or setup system path either.
How to achieve the same on Windows OS?
These are two interrelated important questions as follows :
ChromeDriver
You can download the recently released ChromeDriver from ChromeDriver - WebDriver for Chrome page and place it any where within your system. When you initialize the ChromeDriver you need to pass the absolute path of the ChromeDriver binary.
Additionally, you can also help WebDriver to locate the downloaded ChromeDriver executable through the following steps :
webdriver.chrome.driver
system propertywebdriver.Chrome()
Chromium/Google Chrome
The most important fact is you need to ensure that Chromium/Google Chrome is installed in a recognized location as per the ChromeDriver - Requirements as the server expects you to have Chromium/Google Chrome installed in the default location for each system as per the snapshot:
Note : For Linux systems, the ChromeDriver expects
/usr/bin/google-chrome
to be a symlink to the actual Chrome binary. You can also override the Chrome binary location following Using a Chrome executable in a non-standard location .Sample Code Block
Java :
Python :
For any driver that Selenium must use to open the browser (
chromedriver
,geckodriver
, etc), you don't have to worry about where it is installed, as long as it's set in thePATH
variable.If you have it set in the OS
PATH
variable, you must be able to run it from thecommand
orcmd
(it's always good to make sure it's working).Here's how you can set it (append to the existing value):
Then you can just instantiate it as follows:
OR
Hope it's somehow helpful.
Default location on Windows is:
C:\Program Files\(select the folder you want to put your file)\chromedriver.exe
In your Selenium code, paste the driver path correctly, for example: