Good afternoon. I am trying to use chromedriver with a selenium library in python. It gives me an error that there is no driver, although it is. My OC is Linux mint.
import os
from selenium import webdriver
def main ():
driver = webdriver.Chrome ("/ usr / bin / chromedriver")
driver.get ('google.com')
if __name__ == "__main__":
main ()
Error
Traceback (most recent call last):
File "/var/data/python/lib/python3.7/site-packages/selenium/webdriver/common/service.py", line 76, in start
stdin = PIPE)
File "/usr/lib/python3.7/subprocess.py", line 775, in __init__
restore_signals, start_new_session)
File "/usr/lib/python3.7/subprocess.py", line 1522, in _execute_child
raise child_exception_type (errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: '/ usr / bin / chromedriver': '/ usr / bin / chromedriver'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/hacker/Desktop/pycharmprojects/parser1000rub/main.py", line 11, in & lt; module & gt;
main ()
File "/home/hacker/Desktop/pycharmprojects/parser1000rub/main.py", line 6, in main
driver = webdriver.Chrome ("/ usr / bin / chromedriver")
File "/var/data/python/lib/python3.7/site-packages/selenium/webdriver/chrome/webdriver.py", line 73, in __init__
self.service.start ()
File "/var/data/python/lib/python3.7/site-packages/selenium/webdriver/common/service.py", line 83, in start
os.path.basename (self.path), self.start_error_message)
selenium.common.exceptions.WebDriverException: Message: 'chromedriver' executable needs to be in PATH. Please see https://sites.google.com/a/chromium.org/chromedriver/home
Process finished with exit code 1
Answer 1, authority 100%
Just follow the instructions in the text of the error itself:
Message: ‘chromedriver’ executable needs to be in PATH. Please see
https://sites.google.com/a/chromium.org/chromedriver/ home
Ie using the specified link download the driver and the path to it (enough folders) add to your PATH
environment variable
Alternatively, manually specify the path to the driver in the class via the executable_path parameter :
driver = webdriver.Chrome (executable_path = "& lt; Driver path & gt;")