【发布时间】:2020-11-25 07:28:11
【问题描述】:
我不断收到此错误:
Traceback (most recent call last):
File "C:/Users/LENOVO/Desktop/Coding -Winson/PyCharm/opening_webs.py", line 3, in <module>
driver = webdriver.Chrome('/path/to/chromedriver')
File "C:\Users\LENOVO\AppData\Local\Programs\Python\Python38-32\lib\site-packages\selenium\webdriver\chrome\webdriver.py", line 73, in __init__
self.service.start()
File "C:\Users\LENOVO\AppData\Local\Programs\Python\Python38-32\lib\site-packages\selenium\webdriver\common\service.py", line 81, in start
raise WebDriverException(
selenium.common.exceptions.WebDriverException: Message: 'chromedriver' executable needs to be in PATH. Please see https://sites.google.com/a/chromium.org/chromedriver/home
每次我使用这段代码时:
from selenium import webdriver
webdriver.Chrome(executable_path= "Users\LENOVO\AppData\Local\Programs\Python\Python38-32\chromedriver.exe")
【问题讨论】:
-
你需要在 python 中使用双 \ 作为路径。 IE。
webdriver.Chrome(executable_path= "Users\\LENOVO\\AppData\\Local\\Programs\\Python\\Python38-32\\chromedriver.exe") -
这与 MATLAB 有什么关系?请使用描述问题的标签,不要包含不相关的标签。
-
错误消息显示“请参阅sites.google.com/a/chromium.org/chromedriver/home”。你这样做了吗?
标签: python python-3.x selenium-webdriver executable