【问题标题】:SessionNotCreatedException: Message: session not created: This version of ChromeDriver only supports Chrome version 96 Current browser version is 98.0SessionNotCreatedException:消息:会话未创建:此版本的 ChromeDriver 仅支持 Chrome 版本 96 当前浏览器版本为 98.0
【发布时间】:2022-07-06 15:56:21
【问题描述】:

错误跟踪日志:

DevTools listening on ws://127.0.0.1:54791/devtools/browser/6f264bcc-d44a-40d9-b6cf- 
8b1655c97ccd
Traceback (most recent call last):
File "c:\Users\alsgn\OneDrive\desktop\mypython\getselenium\dc\findbulletins.py", line 11, in 
<module>
browser = webdriver.Chrome()
File "C:\Users\alsgn\AppData\Local\Programs\Python\Python39\lib\site- 
packages\selenium\webdriver\chrome\webdriver.py", line 70, in __init__
super(WebDriver, self).__init__(DesiredCapabilities.CHROME['browserName'], "goog",
File "C:\Users\alsgn\AppData\Local\Programs\Python\Python39\lib\site- 
packages\selenium\webdriver\chromium\webdriver.py", line 93, in __init__
RemoteWebDriver.__init__(
File "C:\Users\alsgn\AppData\Local\Programs\Python\Python39\lib\site- 
packages\selenium\webdriver\remote\webdriver.py", line 268, in __init__
self.start_session(capabilities, browser_profile)
File "C:\Users\alsgn\AppData\Local\Programs\Python\Python39\lib\site- 
packages\selenium\webdriver\remote\webdriver.py", line 359, in start_session
response = self.execute(Command.NEW_SESSION, parameters)
File "C:\Users\alsgn\AppData\Local\Programs\Python\Python39\lib\site- 
packages\selenium\webdriver\remote\webdriver.py", line 424, in execute
self.error_handler.check_response(response)
File "C:\Users\alsgn\AppData\Local\Programs\Python\Python39\lib\site- 
packages\selenium\webdriver\remote\errorhandler.py", line 247, 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 96
Current browser version is 98.0.4758.82 with binary path C:\Program 
Files\Google\Chrome\Application\chrome.exe
Stacktrace:
Backtrace:
    Ordinal0 [0x00FF6903+2517251]
    Ordinal0 [0x00F8F8E1+2095329]
    Ordinal0 [0x00E92848+1058888]
    Ordinal0 [0x00EB0B9D+1182621]
    Ordinal0 [0x00EACA60+1165920]
    Ordinal0 [0x00EAA2CF+1155791]
    Ordinal0 [0x00EDAAAF+1354415]
    Ordinal0 [0x00EDA71A+1353498]
    Ordinal0 [0x00ED639B+1336219]
    Ordinal0 [0x00EB27A7+1189799]
    Ordinal0 [0x00EB3609+1193481]
    GetHandleVerifier [0x01185904+1577972]
    GetHandleVerifier [0x01230B97+2279047]
    GetHandleVerifier [0x01086D09+534521]
    GetHandleVerifier [0x01085DB9+530601]
    Ordinal0 [0x00F94FF9+2117625]
    Ordinal0 [0x00F998A8+2136232]
    Ordinal0 [0x00F999E2+2136546]
    Ordinal0 [0x00FA3541+2176321]
    BaseThreadInitThunk [0x755AFA29+25]
    RtlGetAppContainerNamedObjectPath [0x775C7A9E+286]
    RtlGetAppContainerNamedObjectPath [0x775C7A6E+238]

2天前我跑的代码还可以,但是现在代码出现了这个错误。 请说如何解决这个问题。我想知道为什么它之前运行良好。

【问题讨论】:

  • 错误很明显selenium.common.exceptions.SessionNotCreatedException: Message: session not created: This version of ChromeDriver only supports Chrome version 96 Current browser version is 98.0.4758.82 with binary path C:\Program Files\Google\Chrome\Application\chrome.exe是版本兼容性问题。您的 Chrome 浏览器已更新到 98 版,但您的驱动程序仍然是 96 版。下载更新后的 chromedriver (chromedriver 98),它应该可以工作

标签: selenium google-chrome selenium-webdriver selenium-chromedriver webdriver


【解决方案1】:

此错误消息...

selenium.common.exceptions.SessionNotCreatedException: Message: session not created: This version of ChromeDriver only supports Chrome version 96
Current browser version is 98.0.4758.82 with binary path C:\Program Files\Google\Chrome\Application\chrome.exe

...暗示ChromeDriver 无法启动/产生新的浏览上下文,即 会话。


您的主要问题是您使用的二进制文件版本之间的不兼容性,如下所示:

支持 Chrome 版本 98

支持 Chrome 版本 96

所以 chromedriver=96.0 和 chrome=96.0.4664.45

之间存在明显的不匹配

解决方案

确保:

【讨论】:

    【解决方案2】:

    您的输出日志状态:

    This version of ChromeDriver only supports Chrome version 96
    Current browser version is 98.0.4758.82 with binary path
    

    你有两个选择:

    1. 对 Chrome 98 使用 chromedriver
    2. 安装 Chrome 96

    【讨论】:

      【解决方案3】:

      我也收到此错误消息,因为我忘记打开 chrome 更新。我使用 chromedriver 98.0.4758.80 但现在我的 chrome 是 98.0.4758.82。因此,即使您更新到我使用的最新 chromedriver 98.0.4758.80,您也会收到此消息或基于相同的消息。

      对我来说有两种解决方案,首先关闭 chrome 更新服务。

      • 等待支持 98.0.4758.82 的新 chromedriver 更新
      • 将 chrome 降级到版本 98.0.4758.80 - 我仍在努力执行降级。

      也许有人可以解释如何将 chrome 降级到早期版本。否则需要等待chromedriver的更新。

      【讨论】:

        【解决方案4】:

        @Ssproutt,Chromedriver 已更新至版本 98.0.4758.102。

        1. 将 Chrome 浏览器更新至版本 98.0.4758.102
        2. 下载最新的Chromedriver https://chromedriver.storage.googleapis.com/index.html?path=98.0.4758.102/

        注意您的版本不匹配。您可以通过重命名位于 C:\Program Files (x86)\Google\Update\ 中的 chrome 更新文件 (GoogleUpdate.exe) 来确保不更新您的 chrome 浏览器。

        【讨论】:

          【解决方案5】:

          我也有同样的问题,你应该怎么做,直接去https://chromedriver.chromium.org/downloads 并查看您的浏览器版本并相应下载,只需将 chormedriver.exe(旧)替换为新下载的,它就可以正常工作。

          【讨论】:

            猜你喜欢
            • 2020-06-03
            • 2020-09-28
            • 1970-01-01
            • 2021-08-27
            • 1970-01-01
            • 1970-01-01
            • 2022-01-16
            相关资源
            最近更新 更多