selenium.common.exceptions.SessionNotCreatedException:ChromeDriver仅支持Chrome版本84

2024-06-26 14:57:50 发布

您现在位置:Python中文网/ 问答频道 /正文

我刚刚从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。任何帮助都将不胜感激


Tags: inpybrowservenvlibpackagesseleniumline
2条回答

检查以下两件事:

  1. 浏览器和WebDriver必须是同一版本
  2. browser=webdriver.Chrome('path\u to\u your\u webriver')

嘿,你需要根据chrome浏览器版本使用准确的chrome驱动程序版本 请检查您的浏览器版本,从https://chromedriver.chromium.org/downloads下载驱动程序exe并使用它

相关问题 更多 >