python install_error ai_generated true

selenium.common.exceptions.SessionNotCreatedException: Message: session not created: 此版本的 ChromeDriver 仅支持 Chrome 121

selenium.common.exceptions.SessionNotCreatedException: Message: session not created: This version of ChromeDriver only supports Chrome version 121

ID: python/pytest-selenium-webdriver-manager-fail

其他格式: JSON · Markdown 中文 · English
80%修复率
86%置信度
0证据数
2026-01-08首次发现

版本兼容性

版本状态引入弃用备注
4.15.x active — — —
4.20.x active — — —

根因分析

已安装的 ChromeDriver 版本与本地 Chrome 浏览器不匹配。常见于 Chrome 自动更新但 driver 未同步更新。

English

The installed ChromeDriver version doesn't match the local Chrome browser. This commonly happens after an automatic Chrome update without a corresponding driver update.

generic

解决方案

  1. 94% 成功率
    from selenium import webdriver
    from selenium.webdriver.chrome.service import Service
    
    # Selenium Manager handles driver download automatically
    driver = webdriver.Chrome()  # no Service path needed
  2. 90% 成功率
    from selenium import webdriver
    from selenium.webdriver.chrome.service import Service
    from webdriver_manager.chrome import ChromeDriverManager
    
    driver = webdriver.Chrome(service=Service(ChromeDriverManager().install()))

无效尝试

常见但无效的做法:

  1. 70% 失败

    Works until Chrome auto-updates again; brittle and requires manual re-pinning per machine.

  2. 80% 失败

    Headless mode doesn't bypass the version check; the SessionNotCreatedException is raised before browser launch.