我在python中使用Selenium时遇到错误

时间:2017-10-15 13:20:24

标签: python python-3.x selenium

我尝试使用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

帮助将不胜感激。

1 个答案:

答案 0 :(得分: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/