我刚刚从http://chromedriver.chromium.org/downloads
下载了最新的chromedriver,版本ChromeDriver 84.0.4147.30
。
但是当我试图跑步时
from bs4 import BeautifulSoup
from selenium import webdriver
browser = webdriver.Chrome()
browser.get("https://www.google.com")
它向我显示以下错误消息。
/Users/shahanurmdsharif/development/python/scrapping/venv/bin/python /Users/shahanurmdsharif/development/python/scrapping/index.py
Traceback (most recent call last):
File "/Users/shahanurmdsharif/development/python/scrapping/index.py", line 6, in <module>
browser = webdriver.Chrome()
File "/Users/shahanurmdsharif/development/python/scrapping/venv/lib/python3.8/site-packages/selenium/webdriver/chrome/webdriver.py", line 76, in __init__
RemoteWebDriver.__init__(
File "/Users/shahanurmdsharif/development/python/scrapping/venv/lib/python3.8/site-packages/selenium/webdriver/remote/webdriver.py", line 157, in __init__
self.start_session(capabilities, browser_profile)
File "/Users/shahanurmdsharif/development/python/scrapping/venv/lib/python3.8/site-packages/selenium/webdriver/remote/webdriver.py", line 252, in start_session
response = self.execute(Command.NEW_SESSION, parameters)
File "/Users/shahanurmdsharif/development/python/scrapping/venv/lib/python3.8/site-packages/selenium/webdriver/remote/webdriver.py", line 321, in execute
self.error_handler.check_response(response)
File "/Users/shahanurmdsharif/development/python/scrapping/venv/lib/python3.8/site-packages/selenium/webdriver/remote/errorhandler.py", line 242, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.SessionNotCreatedException: Message: session not created: This version of ChromeDriver only supports Chrome version 84
Process finished with exit code 1
当我使用正确的版本时84.0.4147.30
.任何帮助将不胜感激。
检查以下两件事:
- 浏览器和网络驱动程序应强制为同一版本。
- 浏览器=网络驱动程序。铬("path_to_your_webriver"(
嘿,您需要根据 chrome 浏览器版本使用确切的 chrome 驱动程序版本 请检查您的浏览器版本并从 https://chromedriver.chromium.org/downloads 下载驱动程序 exe 并使用它。