我在 Webdriver 管理器中遇到以下错误:
File "C:\Users\Chetan\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\local-packages\Python312\site-packages\webdriver_manager\core\http.py", line 37, in get
self.validate_response(resp)
File "C:\Users\Chetan\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\local-packages\Python312\site-packages\webdriver_manager\core\http.py", line 16, in validate_response
raise ValueError(f"There is no such driver by url {resp.url}")
ValueError: There is no such driver by url https://chromedriver.storage.googleapis.com/LATEST_RELEASE_119.0.6045
我的代码如下:
from selenium import webdriver
from webdriver_manager.chrome import ChromeDriverManager
driver = webdriver.Chrome(ChromeDriverManager().install())
driver.get('https://pypi.org/project/webdriver-manager/')
如何解决?
找到解决方案;它使用 Botasaurus 自动下载并启动 Chrome。
pip install botasaurus
from botasaurus import *
driver = bt.create_driver()
driver.get("http://www.python.org")
driver.prompt()
driver.quit()