2

For my Selenium/Cucumber/Maven project I downloaded the latest version of the Chrome and IE driver via Webdrivermanager on an virtual machine with an internet connection. After this I used the same project (using the same Maven local repo folder) on a Windows server without an internet connection, set an override for the local Maven repo folder in IntelliJ and added the forceCache option:

ChromeDriverManager.getInstance().forceCache().setup();
driver = new ChromeDriver();

Version of webdrivermanager = 1.7.2

When executing a test via the command line of Windows with Maven command mvn test clean, I receive below connection error. The browser driver is available in the local repo.

INFO BrowserManager - Reading https://chromedriver.storage.googleapis.com/ 
to seek [chromedriver]

[main] INFO BrowserManager - Reading 
https://chromedriver.storage.googleapis.com/ to seek [chromedriver]
[main] WARN BrowserManager - [1/3] Exception reading 
https://chromedriver.storage.googleapis.com/ to seek [chromedriver]: 
org.apache.http.conn.HttpHostConnectException Connect to 
chromedriver.storage.googleapis.com:443 
[chromedriver.storage.googleapis.com/216.58.212.208] failed: Connection 
timed out: connect

UPDATE: I have executed my test again via the virtual machine with an internet connection. It looks like that Maven is still using the default .m2 folder, which doesn't contain the cached browser drivers and webdrivermanager tries to download the files. So this is not an webdrivermanager issue, but a Maven issue. Has anyone suggestions to fix this issue? I have already restarted my machine, but with no luck.

4

1 回答 1

0

Windows 机器中 WebDriverManager 使用的缓存位于C:\Users\your-user\.m2\repository. 具体来说,对于chromedriver,二进制文件应该是 at C:\Users\your-user\.m2\repository\webdriver\chromedriver\win32\2.33\chromedriver.exe。检查此文件是否确实存在,因为这是该forceCache()方法要查找的内容。我再次检查了两次,此功能仍在按预期工作。在您的情况下,缓存文件似乎不可用,因此 WebDriverManager 尝试下载它。

于 2017-10-20T07:49:28.830 回答