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

时间:2020-07-03 10:05:05

标签: python selenium selenium-webdriver web-scraping selenium-chromedriver

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

2 个答案:

答案 0 :(得分:1)

检查以下两项:

  1. 浏览器和WebDriver都必须具有相同的版本。
  2. browser = webdriver.Chrome('path_to_your_webriver')

答案 1 :(得分:1)

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