0

直到昨天我还在使用 Webdriver Manager,它工作成功。但今天它正在抛出一些UnknownHostException

我的依赖:

<dependency>
    <groupId>io.github.bonigarcia</groupId>
    <artifactId>webdrivermanager</artifactId>
    <version>3.0.0</version>
    <scope>test</scope>
</dependency>

这是我用来打开浏览器的方式:

WebDriverManager.chromedriver().setup();
             driver = new ChromeDriver();

我找不到Perfect Solution但我得到some solution的是not clear你们能帮帮我吗!

我的错误:

[INFO] Running TestSuite
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
[ERROR] Tests run: 3, Failures: 1, Errors: 0, Skipped: 2, Time elapsed: 1.382 s <<< FAILURE! - in TestSuite
[ERROR] Start_Browser(Test.LoginTest)  Time elapsed: 1.257 s  <<< FAILURE!
io.github.bonigarcia.wdm.WebDriverManagerException: java.net.UnknownHostException: chromedriver.storage.googleapis.com
    at Test.LoginTest.Start_Browser(LoginTest.java:19)
Caused by: java.net.UnknownHostException: chromedriver.storage.googleapis.com
    at Test.LoginTest.Start_Browser(LoginTest.java:19)

[INFO] 
[INFO] Results:
[INFO] 
[ERROR] Failures: 
[ERROR]   LoginTest.Start_Browser:19->Openbrowser.Setupbrowser:18 » WebDriverManager jav...
[INFO] 
4

2 回答 2

1

我昨天有同样的问题。这是因为有许多 chrome 会话在后台运行。

删除文件夹并尝试 C:\Users\yourUsername\.m2\repository\webdriver

我重新启动了 chrome 并解决了

于 2019-02-13T16:45:03.263 回答
0

我有类似的问题。我的 selenium webdriver 代码可以正常工作,但现在突然不工作了。我得到以下错误。现在不知道如何解决?

23:39:58,881  INFO main                             [Logging] Logger initialized: file:/C:/vivek/dev/automation/ta-cps-roundtrips/target/classes/META-INF/log4j.xml
23:39:58,883  INFO main                             [IntegrationTestSuiteHelper] configroot: src/main/resources
23:40:00,350  INFO main                             [WebDriverManager] Reading https://chromedriver.storage.googleapis.com/ to seek chromedriver
23:40:00,458  INFO main                             [ResolutionCache] Clearing WebDriverManager resolution cache
23:40:00,460  WARN main                             [WebDriverManager] There was an error managing chromedriver 81.0.4044.138 (java.net.UnknownHostException: chromedriver.storage.googleapis.com) ... trying again avoiding reading release from repository
23:40:00,686  WARN main                             [VersionDetector] Error reading version.properties, using local instead
23:40:00,698  INFO main                             [WebDriverManager] Reading https://chromedriver.storage.googleapis.com/ to seek chromedriver
23:40:00,703  WARN main                             [WebDriverManager] There was an error managing chromedriver (latest version) (java.net.UnknownHostException: chromedriver.storage.googleapis.com) ... trying again using latest driver stored in cache
23:40:00,712  INFO main                             [WebDriverManager] Reading https://chromedriver.storage.googleapis.com/ to seek chromedriver
23:40:00,716 ERROR main                             [WebDriverManager] There was an error managing chromedriver (latest version) (java.net.UnknownHostException: chromedriver.storage.googleapis.com)
io.github.bonigarcia.wdm.config.WebDriverManagerException: java.net.UnknownHostException: chromedriver.storage.googleapis.com
    at io.github.bonigarcia.wdm.WebDriverManager.getDriversFromXml(WebDriverManager.java:915)
    at io.github.bonigarcia.wdm.managers.ChromeDriverManager.getDriverUrls(ChromeDriverManager.java:101)
    at io.github.bonigarcia.wdm.WebDriverManager.createUrlHandler(WebDriverManager.java:797)
    at io.github.bonigarcia.wdm.WebDriverManager.download(WebDriverManager.java:649)
    at io.github.bonigarcia.wdm.WebDriverManager.manage(WebDriverManager.java:567)
    at io.github.bonigarcia.wdm.WebDriverManager.fallback(WebDriverManager.java:792)
    at io.github.bonigarcia.wdm.WebDriverManager.handleException(WebDriverManager.java:773)
    at io.github.bonigarcia.wdm.WebDriverManager.manage(WebDriverManager.java:573)
    at io.github.bonigarcia.wdm.WebDriverManager.handleException(WebDriverManager.java:766)
    at io.github.bonigarcia.wdm.WebDriverManager.manage(WebDriverManager.java:573)
    at io.github.bonigarcia.wdm.WebDriverManager.setup(WebDriverManager.java:287)
于 2021-01-15T22:50:50.170 回答