Python Selenium驱动程序.get()引发异常

Python Selenium驱动程序.get()引发异常,python,google-chrome,selenium,selenium-chromedriver,Python,Google Chrome,Selenium,Selenium Chromedriver,运行此代码时: from selenium import webdriver import time driver = webdriver.Chrome('C:/Program Files (x86)/Google/Chrome/Application/chrome.exe') driver.get('https://www.google.com/') 它只打开我的浏览器,而不打开作为参数传递给driver.get()的URL 以下是回溯: Traceback (most recent c

运行此代码时:

from selenium import webdriver
import time

driver = webdriver.Chrome('C:/Program Files 
(x86)/Google/Chrome/Application/chrome.exe')
driver.get('https://www.google.com/')
它只打开我的浏览器,而不打开作为参数传递给
driver.get()
的URL

以下是回溯:

Traceback (most recent call last):
  File "C:\Users\efiqq\OneDrive\Plocha\Python\Link.py", line 4, in <module>
    driver = webdriver.Chrome('C:/Program Files (x86)/Google/Chrome/Application/chrome.exe')
  File "C:\Users\efiqq\AppData\Local\Programs\Python\Python36-32\lib\site-packages\selenium\webdriver\chrome\webdriver.py", line 68, in __init__
    self.service.start()
  File "C:\Users\efiqq\AppData\Local\Programs\Python\Python36-32\lib\site-packages\selenium\webdriver\common\service.py", line 98, in start
    self.assert_process_still_running()
  File "C:\Users\efiqq\AppData\Local\Programs\Python\Python36-32\lib\site-packages\selenium\webdriver\common\service.py", line 111, in assert_process_still_running
    % (self.path, return_code)
selenium.common.exceptions.WebDriverException: Message: Service C:/Program Files (x86)/Google/Chrome/Application/chrome.exe unexpectedly exited. Status code was: 0
回溯(最近一次呼叫最后一次):
文件“C:\Users\efiqq\OneDrive\Plocha\Python\Link.py”,第4行,在
driver=webdriver.Chrome('C:/ProgramFiles(x86)/Google/Chrome/Application/Chrome.exe'))
文件“C:\Users\efiqq\AppData\Local\Programs\Python\Python36-32\lib\site packages\selenium\webdriver\chrome\webdriver.py”,第68行,在\uuu init中__
self.service.start()
文件“C:\Users\efiqq\AppData\Local\Programs\Python\Python36-32\lib\site packages\selenium\webdriver\common\service.py”,第98行,在开始处
self.assert\u进程\u仍在运行()
文件“C:\Users\efiqq\AppData\Local\Programs\Python\Python36-32\lib\site packages\selenium\webdriver\common\service.py”,第111行,断言进程仍在运行
%(self.path,返回\u代码)
selenium.common.exceptions.WebDriverException:Message:Service C:/Program Files(x86)/Google/Chrome/Application/Chrome.exe意外退出。状态代码为:0

您必须传递的路径不是
chrome.exe
。您必须指向
chromedriver.exe


你可以在这里找到它:

我试过了,但它仍然不起作用。如果你删除路径,只使用
driver=webdriver.Chrome()
?如果你已经将chromedriver添加到你的路径中,路径参数是可选的:
driver=webdriver.Chrome('/path/to/chromedriver')#可选参数,如果未指定,将搜索路径。
,:ref: