【问题标题】:I am getting an error in using Selenium in python [duplicate]我在 python 中使用 Selenium 时出错 [重复]
【发布时间】:2026-02-01 11:00:01
【问题描述】:

我尝试使用 selenium 构建程序,但它不支持 Web 驱动程序。我收到以下错误。

Traceback (most recent call last):


File "C:\Users\my dell\AppData\Local\Programs\Python\Python36-32\lib\site-packages\selenium\webdriver\common\service.py", line 74, in start
    stdout=self.log_file, stderr=self.log_file)
  File "C:\Users\my dell\AppData\Local\Programs\Python\Python36-32\lib\subprocess.py", line 707, in __init__
    restore_signals, start_new_session)
  File "C:\Users\my dell\AppData\Local\Programs\Python\Python36-32\lib\subprocess.py", line 990, in _execute_child
    startupinfo)
FileNotFoundError: [WinError 2] The system cannot find the file specified

During handling of the above exception, another exception occurred:
Traceback (most recent call last):
  File "C:\Users\my dell\AppData\Local\Programs\Python\Python36-32\records\sel.py", line 2, in <module>
    browser = webdriver.Chrome()
  File "C:\Users\my dell\AppData\Local\Programs\Python\Python36-32\lib\site-packages\selenium\webdriver\chrome\webdriver.py", line 62, in __init__
    self.service.start()
  File "C:\Users\my dell\AppData\Local\Programs\Python\Python36-32\lib\site-packages\selenium\webdriver\common\service.py", line 81, 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

我们将不胜感激。

【问题讨论】:

标签: python python-3.x selenium


【解决方案1】:

看来你需要安装chromechromedriver

对于 debian linux:

apt install chromium
wget https://chromedriver.storage.googleapis.com/2.29/chromedriver_linux64.zip
unzip chromedriver_linux64.zip
sudo cp chromedriver /usr/bin/

【讨论】: