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/
After downloading the zip file, I unpacked the zip file to my downloads folder. Then I put the path to the executable binary (C:\Users\michael\Downloads\chromedriver_win32) into the Environment Variable "Path".
However, when I run the following code:
from selenium import webdriver
driver = webdriver.Chrome()
... I keep getting the following error message:
WebDriverException: Message: 'chromedriver' executable needs to be available in the path. Please look at http://docs.seleniumhq.org/download/#thirdPartyDrivers and read up at http://code.google.com/p/selenium/wiki/ChromeDriver
But - as explained above - the executable is(!) in the path ... what is going on here?
We have to add path string, begin with the letter
r
before the string, for raw string. I tested this way, and it works.According to the instruction, you need to include the path to ChromeDriver when instantiating webdriver.Chrome eg.:
(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/'
I see the discussions still talk about the old way of setting up chromedriver by downloading the binary and configuring path manually.
This can be done automaticatically using webdriver-manager
Now the above code in the question will work simply with below change,
The same can be used to set Firefox, Edge and ie binaries
If you are working with robot framework RIDE. Then you can download
Chromedriver.exe
from its official website and keep this .exe file inC:\Python27\Scripts
directory. Now mention this path as your environment variable eg.C:\Python27\Scripts\chromedriver.exe
.Restart your computer and run same test case again. You will not get this problem again.