1

Is there any possibility to set up proxy for selenide library?

I start autotests from command line with maven comman:

mvn clean test [some params] site

It was possible to change maven setting to use proxy (in ${maven.home}/conf/settings.xml) so it can download dependencies.

But one of dependencies is which requests http://chromedriver.storage.googleapis.com/ to check/download last version of chromedriver.exe. And here I've got an error:

java.net.UnknownHostException: chromedriver.storage.googleapis.com

io.github.bonigarcia.wdm.WebDriverManagerException: java.net.UnknownHostException: chromedriver.storage.googleapis.com
    at io.github.bonigarcia.wdm.WebDriverManager.handleException(WebDriverManager.java:475)
    at io.github.bonigarcia.wdm.WebDriverManager.manage(WebDriverManager.java:458)
    at io.github.bonigarcia.wdm.WebDriverManager.handleException(WebDriverManager.java:472)
    at io.github.bonigarcia.wdm.WebDriverManager.manage(WebDriverManager.java:458)
    at io.github.bonigarcia.wdm.WebDriverManager.setup(WebDriverManager.java:219)
    at com.codeborne.selenide.webdriver.WebDriverBinaryManager.setupBinaryPath(WebDriverBinaryManager.java:16)
    at com.codeborne.selenide.webdriver.WebDriverFactory.createWebDriver(WebDriverFactory.java:55)
    at com.codeborne.selenide.impl.WebDriverThreadLocalContainer.createDriver(WebDriverThreadLocalContainer.java:231)
    at com.codeborne.selenide.impl.WebDriverThreadLocalContainer.getAndCheckWebDriver(WebDriverThreadLocalContainer.java:118)
    at com.codeborne.selenide.WebDriverRunner.getAndCheckWebDriver(WebDriverRunner.java:136)
    at com.codeborne.selenide.impl.Navigator.navigateToAbsoluteUrl(Navigator.java:68)
    at com.codeborne.selenide.impl.Navigator.open(Navigator.java:32)
    at com.codeborne.selenide.Selenide.open(Selenide.java:95)
    at com.codeborne.selenide.Selenide.open(Selenide.java:69)

UPDATE:

If the network is not available, but there is already any previously downloaded version of chromedriver, this version would be used:

-------------------------------------------------------
 T E S T S
-------------------------------------------------------
Running TestSuite
[main] WARN io.github.bonigarcia.wdm.WebDriverManager - Network not available. F
orcing the use of cache
[main] INFO io.github.bonigarcia.wdm.WebDriverManager - Found chromedriver in ca
che: C:\Users\XUser\.m2\repository\webdriver\chromedriver\win32\2.38\chr
omedriver.exe
[main] INFO io.github.bonigarcia.wdm.WebDriverManager - Exporting webdriver.chro
me.driver as C:\Users\XUser\.m2\repository\webdriver\chromedriver\win32\
2.38\chromedriver.exe

3 Answers 3

1

I guess it's not possible now. Could you register a github issue at https://github.com/codeborne/selenide?

By the way, you can just disable automatic downloading of webdriver in Selenide:

Configuration.driverManagerEnabled = false;

1
1

You will notice that on the proxy request failure, you'll see a failure on a request to http://chromedriver.storage.googleapis.com and you'll notice the reason your firewall blocks it is because their is a redirect on that query that tries to download from an AWS location. A URL that might look something like https://github-production-release-asset-2e65be.s3.amazonaws.com/25354393/.....

So, your best bet is to ask your company to allow downloads from the backup URL, which is http://npm.taobao.org/mirrors, as defined here.

IF you aren't able to request allowing that location, then I would suggest including the drivers (usually stored in .m2/repository/webdriver) in your project root folder and set the System env variable to define where Selenide will look for the local driver.

Good luck. I spent days trying to work around this. It is not likely, in my opinion, that setting proxy env variable will work for you UNLESS you have an un-authenticated proxy. Setting wdm.proxyPass might work if your proxy is not Basic auth.

NOTE: Keep in mind that Java, by default, is configured to ignore Basic auth on proxy URLs unless you override the system env property.

0

There is a system property to set proxy for web driver manager:

System.setProperty("wdm.proxy", url);    // url as "http://host:port"
System.setProperty("wdm.proxyUser", url);
System.setProperty("wdm.proxyPass", url);

More info https://github.com/bonigarcia/webdrivermanager#configuration

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.