Home>
Selenium does not work in python, it gives an error like this Mistake:
Traceback (most recent call last):
File "C: \ Users \ Artem \ AppData \ Local \ Programs \ Python \ Python37-32 \ lib \ site-packages \ selenium \ webdriver \ common \ service.py", line 76, in start
stdin= PIPE)
File "C: \ Users \ Artem \ AppData \ Local \ Programs \ Python \ Python37-32 \ lib \ subprocess.py", line 775, in __init__
restore_signals, start_new_session)
File "C: \ Users \ Artem \ AppData \ Local \ Programs \ Python \ Python37-32 \ lib \ subprocess.py", line 1178, in _execute_child
startupinfo)
FileNotFoundError: [WinError 2] The specified file cannot be found
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C: \ Users \ Artem \ Desktop \ Programs \ Order \ Krunker.py", line 4, in <
module >
driver= webdriver.Chrome ()
File "C: \ Users \ Artem \ AppData \ Local \ Programs \ Python \ Python37-32 \ lib \ site-packages \ selenium \ webdriver \ chrome \ webdriver.py", line 73, in __init__
self.service.start ()
File "C: \ Users \ Artem \ AppData \ Local \ Programs \ Python \ Python37-32 \ lib \ 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
In the folder with the file there are chrome drivers, all of the required version, here is the code itself
from selenium import webdriver
driver= webdriver.Chrome ()
print ('Enter url')
web= input ()
driver.get (web)
-
Answer # 1
Import
from pathlib import Path
Code
BASE_DIR= Path (__ file __). resolve (). parent.parent pathToChromeDriver= f '{self.BASE_DIR} /chromedriver.exe' driver= webdriver.Chrome (pathToChromeDriver)
And drop chromedriver into the root of the project
-
Answer # 2
The driver itself is missing. First download it, called chromedriver (.exe), then unzip it from the archive somewhere, and then in the code in the driver= webdriver.Chrome ('path /chromedriver.exe')
-
Answer # 3
You have not entered a parameter
executable_path
inwebdriver.Chrome
... INexecutable_path
there must be a path to the chrome driver itself.Chrome dvaver lies in the same folder with the script
Developer2021-02-23 23:24:02The path must be specified, just write yourdriver.exe
КИТ KIT2021-02-23 23:24:02
Related questions
- python : Selenium. How to click only on certain subclasses if parent classes are duplicated?
- python : How to upload a connected Tor proxy to Vps Selenium Firefox
- python : Beautifulsoup + Selenium parser does not parse elements from the entire scrolling page (infinite scroll)
- Python Selenium Firefox popup
- python : Parsing a dynamic table
- python : I don't know how to specify a filename when downloading a file from Selenium using Chrome
- python : The sample code of "Transition to specified url" cannot be executed
- Python Selenium Steam Authorization
- python : Error while deploying "git push heroku master"
- python : Loop problem ?????? How to solve? [closed]
Remove Russian letters from the paths. Avoid many obscure python mistakes in the future. Better move python to a short directory. For example c: \ python3 \. Also, just in case, do not install python from the microsoft store. From python.org only
Manul742021-02-24 00:36:02