管理 chromedriver public 时出错(对于输入字符串:“public”)

问题描述 投票:0回答:1

`你好, 使用 webDriverManager,当我的 chrome 浏览器更新时,我出现下一个错误:

`874  [main] ERROR io.github.bonigarcia.wdm.WebDriverManager  – There was an error managing chromedriver public (For input string: "public")
java.lang.NumberFormatException: For input string: "public"
    at java.base/java.lang.NumberFormatException.forInputString(NumberFormatException.java:67)
    at java.base/java.lang.Integer.parseInt(Integer.java:668)
    at java.base/java.lang.Integer.parseInt(Integer.java:786)
    at io.github.bonigarcia.wdm.managers.ChromeDriverManager.buildUrl(ChromeDriverManager.java:177)
    at io.github.bonigarcia.wdm.managers.ChromeDriverManager.buildUrl(ChromeDriverManager.java:154)
    at io.github.bonigarcia.wdm.WebDriverManager.download(WebDriverManager.java:1262)
    at io.github.bonigarcia.wdm.WebDriverManager.manage(WebDriverManager.java:1183)
    at io.github.bonigarcia.wdm.WebDriverManager.fallback(WebDriverManager.java:1430)
    at io.github.bonigarcia.wdm.WebDriverManager.handleException(WebDriverManager.java:1408)
    at io.github.bonigarcia.wdm.WebDriverManager.manage(WebDriverManager.java:1189)
    at io.github.bonigarcia.wdm.WebDriverManager.setup(WebDriverManager.java:426)
    at fr.sihm.tnr.selenium.Browser.browserLaunch(Browser.java:105)`

在我的resolution.properties 文件中,我有

`#WebDriverManager Resolution Cache
#Thu Mar 07 08:43:33 CET 2024
chrome=123
chrome123=**public**
chrome-ttl=09\:43\:33 07/03/2024 CET
chrome123-ttl=15\:46\:23 07/03/2024 CET`

我需要更改为

`#WebDriverManager Resolution Cache
#Thu Mar 07 08:43:33 CET 2024
chrome=123
chrome123=**123.0.6312.22**
chrome-ttl=09\:43\:33 07/03/2024 CET
chrome123-ttl=15\:46\:23 07/03/2024 CET`

在使用版本而不是“公共”自动更新文件之前`

java selenium-webdriver selenium-chromedriver webdrivermanager-java
1个回答
0
投票

使用最新的 WebDriverManager 版本(撰写本文时为 5.7.0)并清除缓存(至少一次)应该可以解决此问题:

WebDriverManager.chromedriver().clearDriverCache().setup();

参见:https://github.com/bonigarcia/webdrivermanager/issues/1239

© www.soinside.com 2019 - 2024. All rights reserved.