Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/selenium/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 硒错误:';chromedriver';可执行文件需要在路径中_Python_Selenium_Selenium Webdriver - Fatal编程技术网

Python 硒错误:';chromedriver';可执行文件需要在路径中

Python 硒错误:';chromedriver';可执行文件需要在路径中,python,selenium,selenium-webdriver,Python,Selenium,Selenium Webdriver,我在运行Debian 9的计算机上安装了Chromium。这里有scraper.py: from selenium import webdriver import time options = webdriver.ChromeOptions() options.add_argument("--ignore-certificate-errors") options.add_argument("--test-type") options.binary_location = "/usr/bin/ch

我在运行Debian 9的计算机上安装了Chromium。这里有
scraper.py

from selenium import webdriver
import time

options = webdriver.ChromeOptions()
options.add_argument("--ignore-certificate-errors")
options.add_argument("--test-type")
options.binary_location = "/usr/bin/chromium"

driver = webdriver.Chrome(chrome_options=options)
driver.get("https://python.org")
铬二元在指定位置。当我运行python
scraper.py
时,我得到了这个错误

Traceback (most recent call last):
  File "scraper.py", line 9, in <module>
    driver = webdriver.Chrome(chrome_options=options)
  File "/home/me/ENV/pbc_vss/local/lib/python2.7/site-packages/selenium/webdriver/chrome/webdriver.py", line 68, in __init__
    self.service.start()
  File "/home/me/ENV/pbc_vss/local/lib/python2.7/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
回溯(最近一次呼叫最后一次):
文件“scraper.py”,第9行,在
driver=webdriver.Chrome(Chrome\u options=options)
文件“/home/me/ENV/pbc_vss/local/lib/python2.7/site packages/selenium/webdriver/chrome/webdriver.py”,第68行,在__
self.service.start()
文件“/home/me/ENV/pbc_vss/local/lib/python2.7/site packages/selenium/webdriver/common/service.py”,第83行,开头
os.path.basename(self.path)、self.start\u错误消息)
selenium.common.exceptions.WebDriverException:消息:“chromedriver”可执行文件需要位于路径中。请看https://sites.google.com/a/chromium.org/chromedriver/home

指定chrome驱动程序所在的路径,下载页面


您的浏览器二进制文件(在本例中为)与您的浏览器二进制文件不同。例如,拥有二进制意味着您可以自己启动Chrome,但webdrivers将无法启动自己的chrom实例(e/ium),从而阻止您将selenium与它们一起使用。解决方法是在路径上的文件夹中下载您选择的chromedriver可执行文件(请注意,版本可能很重要),或者在创建webdriver时直接提供路径。

chromedriver!=chrome(或chrome)浏览器。您是否下载了位于提供站点的文件。google链接?我需要做什么更改才能在Chrome中打开此文件?安装chromedriver可执行文件后,您是否仍会出现此错误?此问题有太多重复项,很难只选择一个。请将
chromedriver
与Chrome binary放在同一文件夹中。Works Now我怀疑这不是路径问题,因为@Username没有必要的文件,给出了他们的评论
driver = webdriver.Chrome(executable_path='/path/to/driver/chromedriver')