Grails 4.0.10+Geb测试遇DriverUrlNotFoundException问题求助
解决Geb测试中ChromeDriver URL未找到的问题
可能的原因及对应解决方案
1. 架构配置与驱动发布规则不匹配
ChromeDriver针对Windows平台,从较新版本起仅提供win32通用包(兼容32位和64位系统),你配置的architecture = 'X86'可能导致插件在查找驱动URL时使用了错误的命名逻辑。
修复操作:
修改build.gradle中的chromedriver配置,移除架构指定项,让插件自动适配系统:
webdriverBinaries { chromedriver { version = '108.0.5359.71' // 移除 architecture = 'X86' 这一行 } geckodriver '0.24.0' }
或者显式指定64位架构(适配你的64位系统):
webdriverBinaries { chromedriver { version = '108.0.5359.71' architecture = 'X86_64' } geckodriver '0.24.0' }
2. 浏览器与驱动版本不完全匹配
你的Chrome已更新至108.0.5359.72,但驱动版本停留在108.0.5359.71,小版本差异可能导致插件的远程索引匹配失败。
修复操作:
将ChromeDriver版本同步为与Chrome完全一致的108.0.5359.72,更新配置:
webdriverBinaries { chromedriver { version = '108.0.5359.72' } geckodriver '0.24.0' }
3. 直接使用本地已下载的驱动
既然你已经手动下载了对应版本的ChromeDriver,可以跳过远程下载,让插件直接使用本地文件:
在build.gradle中添加本地仓库配置,指向你存放驱动的目录:
webdriverBinaries { localRepository = file('你的驱动文件存放路径') chromedriver { version = '108.0.5359.71' } geckodriver '0.24.0' }
确保本地目录中存在对应版本的chromedriver.exe文件。
4. 升级webdriver-binaries插件版本
旧版本的com.github.erdi.webdriver-binaries插件可能未收录ChromeDriver 108版本的索引信息,尝试升级插件:
在build.gradle的插件依赖中更新版本(选择兼容Grails 4的最新版):
plugins { // 保留其他原有插件 id "com.github.erdi.webdriver-binaries" version "2.6" }
内容的提问来源于stack exchange,提问作者kofhearts
相关产品推荐
相关产品推荐

