I have installed python, python-pip and selenium package from pycharm (I am using Manjaro Linux OS) for automation but I am unable to load chrome webdriver gives error which is attached herewith. I downloaded same version chromedriver file as is of my current chrome browser and pasted into project folder also the same file is present in /usr/local/bin/chromedriver. Don't have any idea why it is still giving me error. Help will be appreciated. Thanks.
I tried to run these lines of code:
from selenium import webdriver
browser = webdriver.Chrome(executable_path='./chromedriver')
browser.get('www.google.com')
and I get these errors:
/home/abubakar/PycharmProjects/pythonProject_01/main.py:2: DeprecationWarning: executable_path has been deprecated, please pass in a Service object
browser = webdriver.Chrome(executable_path='./chromedriver')
Traceback (most recent call last):
File "/home/abubakar/PycharmProjects/pythonProject_01/venv/lib/python3.10/site-packages/selenium/webdriver/common/service.py", line 71, in start
self.process = subprocess.Popen(cmd, env=self.env,
File "/usr/lib/python3.10/subprocess.py", line 969, in __init__
self._execute_child(args, executable, preexec_fn, close_fds,
File "/usr/lib/python3.10/subprocess.py", line 1845, in _execute_child
raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: './chromedriver'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/abubakar/PycharmProjects/pythonProject_01/main.py", line 2, in <module>
browser = webdriver.Chrome(executable_path='./chromedriver')
File "/home/abubakar/PycharmProjects/pythonProject_01/venv/lib/python3.10/site-packages/selenium/webdriver/chrome/webdriver.py", line 69, in __init__
super().__init__(DesiredCapabilities.CHROME['browserName'], "goog",
File "/home/abubakar/PycharmProjects/pythonProject_01/venv/lib/python3.10/site-packages/selenium/webdriver/chromium/webdriver.py", line 89, in __init__
self.service.start()
File "/home/abubakar/PycharmProjects/pythonProject_01/venv/lib/python3.10/site-packages/selenium/webdriver/common/service.py", line 81, in start
raise WebDriverException(
selenium.common.exceptions.WebDriverException: Message: 'chromedriver' executable needs to be in PATH. Please see https://chromedriver.chromium.org/home
Process finished with exit code 1