# selenium.common.exceptions.SessionNotCreatedException：消息：会话未创建：此版本的 ChromeDriver 仅支持 Chrome 版本 120
当前浏览器版本为 124.0.6367.78

- **ID:** `python/pytest-selenium-webdriver-not-found`
- **领域:** python
- **类别:** system_error
- **验证级别:** ai_generated
- **修复率:** 80%

## 根因

ChromeDriver 二进制版本与已安装的 Chrome 浏览器版本不匹配。Selenium 4.x 通过 Selenium Manager 自动管理驱动，但 PATH 上过时的 chromedriver 会优先使用并导致不匹配。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| 4.18 | active | — | — |

## 解决方案

1. **** (95% 成功率)
   ```
   which chromedriver && sudo rm $(which chromedriver)
pytest tests/e2e/ -v
# Selenium Manager downloads the correct driver on first run
   ```
2. **** (90% 成功率)
   ```
   # Dockerfile
RUN apt-get install -y google-chrome-stable=124.* 
# or use selenium/standalone-chrome:124.0 image
# pytest with RemoteWebDriver pointing to the container
   ```

## 无效尝试

- **** — Security risk and often blocked by corporate IT; also brittle since Chrome auto-updates. (85% 失败率)
- **** — Headless still launches a real Chrome binary; the version check happens before mode selection. (90% 失败率)
