Python библиотека Selenium не видите chromedriver. Linux

введите сюда описание изображения Добры день. Я пытаюсь использовать chromedriver с библиотекой на selenium на python. Мне выдает ошибку, что нету драйвера, хотя он есть. Моя OC - Linux mint.

import os
from selenium import webdriver

def main():
    driver = webdriver.Chrome("/usr/bin/chromedriver")
    driver.get('google.com')


if __name__ == "__main__":

main()

Ошибка

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 <module>
    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


Ответы (1 шт):

Автор решения: D. Violet

Просто следуйте инструкции в тексте самой ошибки:

Message: 'chromedriver' executable needs to be in PATH. Please see https://sites.google.com/a/chromium.org/chromedriver/home

Т.е. по указанной ссылке скачайте драйвер и путь к нему (достаточно папки) добавьте в переменную среды PATH

Или же вручную укажите путь к драйверу в классе через параметр executable_path:

driver = webdriver.Chrome(executable_path="<Путь до драйвера>")

Источник

→ Ссылка