I have difficulties in finding a solution, can you help me? This is the code text:
from selenium import webdriver
web = webdriver.Chrome("C:\ Users\giova\Desktop\chromedriver.exe")
web.get("https://www.youtube.com/")
This is the error that i receive when i run the program:
C:\Users\giova\PycharmProjects\pythonProject\venv\Scripts\python.exe C:/Users/giova/PycharmProjects/pythonProject/main.py
C:\Users\giova\PycharmProjects\pythonProject\main.py:2: DeprecationWarning: executable_path has been deprecated, please pass in a Service object
web= webdriver.Chrome("C:\ Users\giova\Desktop\chromedriver.exe")
Traceback (most recent call last):
File "C:\Users\giova\PycharmProjects\pythonProject\venv\lib\site-packages\selenium\webdriver\common\service.py", line 71, in start
self.process = subprocess.Popen(cmd, env=self.env,
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.1520.0_x64__qbz5n2kfra8p0\lib\subprocess.py", line 969, in __init__
self._execute_child(args, executable, preexec_fn, close_fds,
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.1520.0_x64__qbz5n2kfra8p0\lib\subprocess.py", line 1438, in _execute_child
hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
FileNotFoundError: [WinError 2] Impossibile trovare il file specificato
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\giova\PycharmProjects\pythonProject\main.py", line 2, in <module>
web= webdriver.Chrome("C:\ Users\giova\Desktop\chromedriver.exe")
File "C:\Users\giova\PycharmProjects\pythonProject\venv\lib\site-packages\selenium\webdriver\chrome\webdriver.py", line 70, in __init__
super(WebDriver, self).__init__(DesiredCapabilities.CHROME['browserName'], "goog",
File "C:\Users\giova\PycharmProjects\pythonProject\venv\lib\site-packages\selenium\webdriver\chromium\webdriver.py", line 89, in __init__
self.service.start()
File "C:\Users\giova\PycharmProjects\pythonProject\venv\lib\site-packages\selenium\webdriver\common\service.py", line 81, in start
raise WebDriverException(
selenium.common.exceptions.WebDriverException: Message: 'chromedriver.exe' executable needs to be in PATH. Please see https://chromedriver.chromium.org/home