Created
May 13, 2019 16:21
-
-
Save seleniumgists/9ac5e9df344492ecae3bea811aae6f03 to your computer and use it in GitHub Desktop.
generated automatically from #selenium on seleniumhq slack
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private static Proxy proxySettings() { | |
BrowserMobProxy browserMobProxy = getProxy(); | |
if(browserMobProxy.isStarted()) { | |
String proxyHost = System.getProperty("proxy.host", ""); | |
Proxy proxy; | |
if(proxyHost.isEmpty()) { | |
if(runningUsingDocker()) { | |
proxyHost = "host.docker.internal"; | |
String proxyString = proxyHost + ":" + browserMobProxy.getPort(); | |
proxy = new Proxy(); | |
proxy.setHttpProxy(proxyString); | |
proxy.setSslProxy(proxyString); | |
} else { | |
proxy = createSeleniumProxy(browserMobProxy); | |
} | |
} else { | |
proxy = new Proxy(); | |
String proxyString = proxyHost + ":" + browserMobProxy.getPort(); | |
proxy.setHttpProxy(proxyString); | |
proxy.setSslProxy(proxyString); | |
} | |
return proxy; | |
} | |
return null; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment