When running code:
PhantomJsDriverManager.getInstance().forceCache().setup();
Or:
PhantomJsDriverManager.getInstance().setup();
I get a certificate exception when the driver is being downloaded:
java.lang.RuntimeException: javax.net.ssl.SSLPeerUnverifiedException: Host name 'bbuseruploads.s3.amazonaws.com' does not match the certificate subject provided by the peer (CN=*.s3.amazonaws.com, O=Amazon.com Inc., L=Seattle, ST=Washington, C=US)
at io.github.bonigarcia.wdm.BrowserManager.manage(BrowserManager.java:262)
at io.github.bonigarcia.wdm.BrowserManager.setup(BrowserManager.java:765)
at io.github.bonigarcia.wdm.BrowserManager.setup(BrowserManager.java:725)
This also happens for other drivers like OperaDriverManager and FirefoxDriverManager
I tested:
This certificate problem is probably out of control for the plugin.
My question is: How can I ensure the downloads always work? Can I add the browser driver downloads to my local Maven Nexus repository to avoid such problems causing my builds to fail?
Or do I need to setup a local webserver and adapt the webdrivermanager.properties file and adapt: wdm.phantomjsDriverUrl=https://bitbucket.org/ariya/phantomjs/downloads/ wdm.phantomjsDriverTaobaoUrl=http://npm.taobao.org/mirrors/phantomjs
You can download manually the binary and store it in the place where WebDriverManager is going to look for it. In the case of PhantomJS, and supposing you want to use version 2.5.0, that place is:
~/.m2/repository/webdriver/phantomjs/<plaform>/2.5.0
For example, for Windows:
C:/Users/your-user/.m2/repository/webdriver/phantomjs/windows/2.5.0/phantomjs.exe
... or for Linux (Ubuntu Xenial):
/home/your-user/.m2/repository/webdriver/phantomjs/linux-ubuntu-xenial-x86_64/2.5.0/phantomjs
After that, you can force to use it using the method forceCache()
:
PhantomJsDriverManager.getInstance().forceCache().setup();