I am using selenium with python and have downloaded the chromedriver for my windows computer from this site: http://chromedriver.storage.googleapis.com/index.html?path=2.15/
Add the webdriver(chromedriver.exe or geckodriver.exe) here C:\Windows. This worked in my case
Before you add the chromedriver to your path, make sure it's the same version as your browser.
If not, you will need to match versions: either update/downgrade you chrome, and upgrade/downgrade your webdriver.
I recommend updating your chrome version as much as possible, and the matching the webdriver.
To update chrome:
help
-> About Google Chrome
Then download the compatible version from here: http://chromedriver.chromium.org/downloads .
Note: The newest chromedriver doesn't always match the newest version of chrome!
Now you can add it to the PATH:
create a new folder somewhere in your computer, where you will place your web drivers.
I created a folder named webdrivers
in C:\Program Files
copy the folder path. In my case it was C:\Program Files\webdrivers
right click on this PC
-> properties
:
Advanced System settings
Environment Variables
System variables
, click on path
and click edit
new
Thats it! I used pycharm and I had to reopen it. Maybe its the same with other IDEs or terminals.
(for Mac users) I have the same problem but i solved by this simple way: You have to put your chromedriver.exe in the same folder to your executed script and than in pyhton write this instruction :
import os
os.environ["PATH"] += os.pathsep + r'X:/your/folder/script/'
Had this issue with Mac Mojave running Robot test framework and Chrome 77. This solved the problem. Kudos @Navarasu for pointing me to the right track.
$ pip install webdriver-manager --user # install webdriver-manager lib for python
$ python # open python prompt
Next, in python prompt:
from selenium import webdriver
from webdriver_manager.chrome import ChromeDriverManager
driver = webdriver.Chrome(ChromeDriverManager().install())
# ctrl+d to exit
This leads to the following error:
Checking for mac64 chromedriver:xx.x.xxxx.xx in cache
There is no cached driver. Downloading new one...
Trying to download new driver from http://chromedriver.storage.googleapis.com/xx.x.xxxx.xx/chromedriver_mac64.zip
...
TypeError: makedirs() got an unexpected keyword argument 'exist_ok'
~/chromedriver/chromedriver
Open ~/.bash_profile
with editor and add:
export PATH="$HOME/chromedriver:$PATH"
Open new terminal window, ta-da
I encountered the same problem as yours. I'm using PyCharm to write programs, and I think the problem lies in environment setup in PyCharm rather than the OS. I solved the problem by going to script configuration and then editing the PATH in environment variables manually. Hope you find this helpful!
Check the path of your chrome driver, it might not get it from there. Simply Copy paste the driver location into the code.