java.net.UnknownHostException Can't Solve in selenium

寵の児 提交于 2021-01-29 07:48:29

问题


Till Yesterday i was using Webdriver Manager it was working sucessfully. but today it is Throwing some UnknownHostException

My Dependinces :

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

This is the way i used to open the browser :

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

I can't find a Perfect Solution but am getting some solution which is not clear can you Guys help me out!

My Error :

[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] 

回答1:


I had same issue last day. It was because there were many chrome sessions running in background.

Delete Folder and try C:\Users\yourUsername\.m2\repository\webdriver

and I restarted chrome and it worked out




回答2:


I had similar issue. My code with selenium webdriver was working and all of a sudden its not working now. I am getting below error. No idea how to fix it now?

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)


来源:https://stackoverflow.com/questions/54672106/java-net-unknownhostexception-cant-solve-in-selenium

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!