You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Selenium 4.11.2中webdriver.Chrome()获取的ChromeDriver版本是多少?

关于Selenium 4.11.2中webdriver.Chrome()获取ChromeDriver版本的说明

首先明确:webdriver.Chrome()不会自动获取最新版本的ChromeDriver,它的核心逻辑是匹配你本地已安装的Chrome浏览器版本。

从Selenium 4.6.0开始,官方引入了Selenium Manager工具,webdriver.Chrome()调用时会自动触发这个工具完成以下操作:

  • 检测本地系统中已安装的Chrome浏览器的具体版本
  • 根据浏览器版本,下载与之完全兼容的ChromeDriver版本(而非最新版驱动)
  • 自动配置驱动路径,无需手动指定

举个例子:如果你的电脑上装的是Chrome 116.x版本,那么Selenium Manager会下载对应116.x系列的ChromeDriver,哪怕此时ChromeDriver已经更新到了117.x版本。

如果你的系统中没有安装Chrome浏览器,Selenium Manager会自动下载当前最新稳定版的Chrome浏览器,同时匹配对应的ChromeDriver版本——这是唯一会获取“最新”相关驱动的场景,但前提是无本地Chrome。

若你需要强制指定ChromeDriver版本,可以通过以下方式实现:

from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.chrome.service import Service

options = Options()
service = Service(executable_path="你指定的ChromeDriver路径")
driver = webdriver.Chrome(service=service, options=options)

内容的提问来源于stack exchange,提问作者Super Kai - Kazuya Ito

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.13 02:04:53