已经安装了chromedriver,但是由于某些原因,在运行此代码时,我的新计算机上仍然出现此问题,我收到此错误消息:
import requests, bs4, sys, webbrowser, random, pyperclip, re, time
from selenium import webdriver
from webdriver_manager.chrome import ChromeDriverManager
from selenium.webdriver.common.keys import Keys
browser = webdriver.Chrome()
Traceback (most recent call last):
File "C:\Users\Arthur\Downloads\file.py", line 3, in <module>
from webdriver_manager.chrome import ChromeDriverManager
ModuleNotFoundError: No module named 'webdriver_manager'
新错误消息:
Traceback (most recent call last):
File "C:\Users\Arthur\Downloads\fantasyfeeder.py", line 6, in <module>
browser = webdriver.Chrome()
File "C:\Users\Arthur\AppData\Local\Programs\Python\Python38\lib\site-packages\selenium\webdriver\chrome\webdriver.py", line 73, in __init__
self.service.start()
File "C:\Users\Arthur\AppData\Local\Programs\Python\Python38\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
您的代码尝试导入名为的包webdriver_manager
。我假设是这个。您是否尝试安装它?
pip install webdriver_manager
编辑有关新错误消息的信息:您的系统需要知道在哪里可以找到chromedriver.exe
。您可以将其放入系统PATH
变量中的目录中,或者只是告诉构造函数它的位置:
browser = webdriver.Chrome('C:\\path\\to\\chromedriver.exe')
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句