【问题标题】:Getting this error with chromedriver when try to load it using selenium and python尝试使用 selenium 和 python 加载 chromedriver 时出现此错误
【发布时间】:2017-05-22 21:19:31
【问题描述】:
Python 3.6.0 (v3.6.0:41df79263a11, Dec 23 2016, 07:18:10) [MSC v.1900 32 bit (Intel)] on win32
Type "copyright", "credits" or "license()" for more information.
 from selenium import webdriver
 browser = webdriver.Chrome(executable_path = "\\Users\\WorkStation\\AppData\\Local\\Programs\\Python\\Python36-32\\selenium\\webdriver\\chrome\\chromedriver.exe")
Traceback (most recent call last):
  File "C:\Users\WorkStation\AppData\Local\Programs\Python\Python36-32\selenium\webdriver\common\service.py", line 74, in start
    stdout=self.log_file, stderr=self.log_file)
  File "C:\Users\WorkStation\AppData\Local\Programs\Python\Python36-32\lib\subprocess.py", line 665, in __init__
    errread, errwrite) = self._get_handles(stdin, stdout, stderr)
  File "C:\Users\WorkStation\AppData\Local\Programs\Python\Python36-32\lib\subprocess.py", line 910, in _get_handles
    c2pwrite = msvcrt.get_osfhandle(self._get_devnull())
  File "C:\Users\WorkStation\AppData\Local\Programs\Python\Python36-32\lib\subprocess.py", line 770, in _get_devnull
    self._devnull = os.open(os.devnull, os.O_RDWR)
FileNotFoundError: [Errno 2] No such file or directory: 'nul'

在处理上述异常的过程中,又发生了一个异常:

Traceback(最近一次通话最后一次):

File "<pyshell#1>", line 1, in <module>
    browser = webdriver.Chrome(executable_path = "\\Users\\WorkStation\\AppData\\Local\\Programs\\Python\\Python36-32\\selenium\\webdriver\\chrome\\chromedriver.exe")
File "C:\Users\WorkStation\AppData\Local\Programs\Python\Python36-32\selenium\webdriver\chrome\webdriver.py", 
line 62, in __init__self.service.start()
File "C:\Users\WorkStation\AppData\Local\Programs\Python\Python36-32\selenium\webdriver\common\service.py", 
line 81, in start os.path.basename(self.path), self.start_error_message)
selenium.common.exceptions.WebDriverException: Message: 'chromedriver.exe' executable needs to be in PATH. 
Please see https://sites.google.com/a/chromium.org/chromedriver/home

【问题讨论】:

    标签: python-3.x selenium-webdriver selenium-chromedriver


    【解决方案1】:

    我使用这种语法。试试看:

    browser = webdriver.Chrome("C:\Program Files (x86)\Google\Chrome\Application\chromedriver.exe")
    

    【讨论】:

      【解决方案2】:

      我试过这个。希望这对你有用。 driver = webdriver.Chrome('C:\\Users\\Admin\\AppData\\Local\\Google\\Chrome\\Application\\chromedriver.exe')

      【讨论】:

        猜你喜欢
        • 2013-07-08
        • 1970-01-01
        • 1970-01-01
        • 2020-10-25
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2018-05-03
        • 1970-01-01
        相关资源
        最近更新 更多