在使用 Selenium 时,我正在使用WebDriverManager来处理浏览器驱动程序的下载。驱动程序存储在默认缓存位置。对于正在使用的其他浏览器(firefox、chrome、edge),会检测到缓存的驱动程序。似乎没有检测到 IE 的缓存驱动程序。
[DEBUG] The driver version for Internet Explorer is unknown ... trying with latest
[INFO] Reading https://selenium-release.storage.googleapis.com/ to seek IEDriverServer
[WARN] There was an error managing IEDriverServer (latest version) (java.net.UnknownHostException: selenium-release.storage.googleapis.com) ... trying again using latest driver stored in cache
[DEBUG] The driver version for Internet Explorer is unknown ... trying with latest
[INFO] Reading https://selenium-release.storage.googleapis.com/ to seek IEDriverServer
脱机运行时,结果是抛出异常。
[ERROR] There was an error managing IEDriverServer (latest version) (java.net.UnknownHostException: selenium-release.storage.googleapis.com)
io.github.bonigarcia.wdm.config.WebDriverManagerException: java.net.UnknownHostException: selenium-release.storage.googleapis.com
at io.github.bonigarcia.wdm.WebDriverManager.getDriversFromXml(WebDriverManager.java:915)
at io.github.bonigarcia.wdm.managers.InternetExplorerDriverManager.getDriverUrls(InternetExplorerDriverManager.java:92)
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:769)
at io.github.bonigarcia.wdm.WebDriverManager.manage(WebDriverManager.java:573)
at io.github.bonigarcia.wdm.WebDriverManager.setup(WebDriverManager.java:287)
我有 try/catch 来处理这个异常。有解决办法吗?