Selenium报错:mac-arm64无115.0.5790.114版本驱动,求解决方案
解决思路:Selenium报错"No such driver version 115.0.5790.114 for mac-arm64"
问题根源
Chrome 115及以上版本启用了新的驱动分发渠道,你使用的webdriver-manager==3.9.1版本不兼容这个新渠道,导致无法找到对应版本的ChromeDriver。
具体解决方案
1. 升级webdriver-manager到兼容版本
执行以下命令升级到支持Chrome 115+的版本:
pip install --upgrade webdriver-manager
建议升级到4.0.0及以上版本,该版本开始适配Chrome新的驱动分发机制。
2. 调整代码适配新版webdriver-manager
升级后,原有代码基本可以正常运行,也可以使用更简洁的写法:
from selenium import webdriver from selenium.webdriver.chrome.service import Service from webdriver_manager.chrome import ChromeDriverManager options = webdriver.ChromeOptions() options.headless = True options.page_load_strategy = 'none' # 自动匹配Chrome版本并安装驱动 driver = webdriver.Chrome( service=Service(ChromeDriverManager().install()), options=options ) driver.implicitly_wait(5) driver.maximize_window()
如果需要指定特定版本,可修改为:
ChromeDriverManager(driver_version="115.0.5790.114").install()
3. 手动下载ChromeDriver(备选方案)
如果升级依赖仍有问题,可手动下载对应驱动:
- 找到Chrome官方提供的对应版本(115.0.5790.114)mac-arm64版ChromeDriver
- 解压后将驱动路径直接传入
Service:
chrome_service = Service('/Users/yourname/path/to/chromedriver') driver = webdriver.Chrome(options=options, service=chrome_service)
验证要点
确保本地Chrome浏览器版本与ChromeDriver版本完全一致,版本号需精确匹配到最后一段。
内容的提问来源于stack exchange,提问作者RichS
相关产品推荐
相关产品推荐

