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

macOS Ventura更新后ChromeDriver 114与Chrome 118兼容问题求助

解决Rails 6 + Selenium 3.142.7下ChromeDriver与Chrome版本不兼容问题

问题场景

升级操作系统到Ventura(Sonoma发布前)后,所有依赖Capybara的RSpec测试无法运行,报错如下:

Selenium::WebDriver::Error::SessionNotCreatedError:
  session not created: This version of ChromeDriver only supports Chrome version 114
  Current browser version is 118.0.5993.117 with binary path /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

项目环境限制:

  • Rails 6.0.6.1
  • Ruby 2.6.6p146
  • 无法升级selenium-webdriver到4.11+版本,只能停留在3.142.7,因此ChromeDriver最高仅支持114.0.5735.90版本

已尝试的无效方案

  • 下载Chrome 114指定版本,但系统始终调用已更新的118版本浏览器
  • 通过brew更新ChromeDriver,无法匹配到对应兼容版本
  • 手动指定ChromeDriver版本时出现404错误,原因是webdrivers gem仍在旧地址查找新版本

最终可行方案

通过GitHub Codespaces绕过本地环境冲突,在Dockerfile中添加以下配置,安装对应版本的Chrome和ChromeDriver:

# Setup ChromeDriver
ARG CHROMEDRIVER_VERSION=114.0.5735.90

# Install Google Chrome and ChromeDriver
RUN wget -q https://chromedriver.storage.googleapis.com/$CHROMEDRIVER_VERSION/chromedriver_linux64.zip \
    && unzip chromedriver_linux64.zip \
    && rm chromedriver_linux64.zip \
    && mv chromedriver /usr/local/bin/
RUN wget -q -O google-chrome.deb https://dl.google.com/linux/chrome/deb/pool/main/g/google-chrome-stable/google-chrome-stable_114.0.5735.90-1_amd64.deb \
    && dpkg -i google-chrome.deb \
    && apt-get install -y -f \
    && rm google-chrome.deb

内容的提问来源于stack exchange,提问作者Frank

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.07 13:05:22