sebastian sebastian - 22 days ago 7
Python Question

selenium - chromedriver executable needs to be in PATH

quote from the error msg: 'chromedriver' executable needs to be in PATH

I was trying to code a script using selenium in pycharm. But then I got the above error. I have already linked my selenium to pycharm as seen here: https://gyazo.com/b5622e3165bbfd93cfa205178df79b6f -(fresh and up to date)

I am new to selenium, isnt chromedriver in the folder "selenium."
If it isnt where can I find it and add it to the path?

By the way, tried typing "chromedriver" in cmd, it wasnt recognized as an internal or external command.

error:

Traceback (most recent call last):
File "C:\Users\sebastian\AppData\Local\Programs\Python\Python35-32\lib\site-packages\selenium\webdriver\common\service.py", line 64, in start
stdout=self.log_file, stderr=self.log_file)
File "C:\Users\sebastian\AppData\Local\Programs\Python\Python35-32\lib\subprocess.py", line 947, in __init__
restore_signals, start_new_session)
File "C:\Users\sebastian\AppData\Local\Programs\Python\Python35-32\lib\subprocess.py", line 1224, in _execute_child
startupinfo)
PermissionError: [WinError 5] Adgang nægtet

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "C:/Users/sebastian/PycharmProjects/web/bot.py", line 10, in <module>
browser = webdriver.Chrome("C:/Users/sebastian/desktop/selenium-3.0.1")
File "C:\Users\sebastian\AppData\Local\Programs\Python\Python35-32\lib\site-packages\selenium\webdriver\chrome\webdriver.py", line 62, in __init__
self.service.start()
File "C:\Users\sebastian\AppData\Local\Programs\Python\Python35-32\lib\site-packages\selenium\webdriver\common\service.py", line 76, in start
os.path.basename(self.path), self.start_error_message)
selenium.common.exceptions.WebDriverException: Message: 'selenium-3.0.1' executable may have wrong permissions. Please see https://sites.google.com/a/chromium.org/chromedriver/home

Exception ignored in: <bound method Service.__del__ of <selenium.webdriver.chrome.service.Service object at 0x01EDEAF0>>
Traceback (most recent call last):
File "C:\Users\sebastian\AppData\Local\Programs\Python\Python35-32\lib\site-packages\selenium\webdriver\common\service.py", line 163, in __del__
self.stop()
File "C:\Users\sebastian\AppData\Local\Programs\Python\Python35-32\lib\site-packages\selenium\webdriver\common\service.py", line 135, in stop
if self.process is None:
AttributeError: 'Service' object has no attribute 'process'

Answer

You can download ChromeDriver here: https://sites.google.com/a/chromium.org/chromedriver/downloads

then add it either to your path, or put it in the same directory as your python script or specify the location directly, e.g.

driver = webdriver.Chrome('C:/path/to/chromedriver.exe')
Comments