--
---
You received this message because you are subscribed to the Google Groups "BrowserMob Proxy" group.
To unsubscribe from this group and stop receiving emails from it, send an email to browsermob-proxy+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
public class RemoteWebDriverFactory {
public static final String SELENIUM_HUB = "http://___.de:4444/wd/hub";
public static RemoteWebDriver driver = null;
public static BrowserMobProxy proxy = new BrowserMobProxyServer();
public static void setupDriver() throws MalformedURLException {
proxy.start(4455);
String browser = ConfigParser.getBrowser();
Proxy seleniumProxy = ClientUtil.createSeleniumProxy(proxy);
if (browser.equalsIgnoreCase("chrome")) {
DesiredCapabilities capability = new DesiredCapabilities();
capability.setCapability(CapabilityType.PROXY, seleniumProxy);
capability.setBrowserName("chrome");
capability.setPlatform(Platform.WIN10);
System.setProperty("webdriver.chrome.driver", "/usr/bin/google-chrome");
remoteWebDriver(capability, new URL(SELENIUM_HUB));
} else {
System.out.println("Using default browser as firefox");
DesiredCapabilities capability = new DesiredCapabilities();
capability.setBrowserName("firefox");
capability.setPlatform(Platform.WIN10);
remoteWebDriver(capability, new URL(SELENIUM_HUB));
}
setupBrowser(driver);
}
org.openqa.selenium.net.NetworkUtils utils = new org.openqa.selenium.net.NetworkUtils();
InetAddress nonLoopBackInet = utils.getIp4NonLoopbackAddressOfThisMachine();
proxy.start(4455, nonLoopBackInet);
Proxy seleniumProxy = ClientUtil.createSeleniumProxy(proxy, nonLoopBackInet);
--
Something wrong with the proxy server or address is incorrect.
ERR_PROXY_CONNECTION_FAILED.09:13:50.233 INFO - Executing: [new session: Capabilities [{proxy={autodetect=false, httpProxy=jenkins....:4455, proxyType=MANUAL, hCode=1835841364, class=org.openqa.selenium.Proxy, sslProxy=jenkins....:4455}, browserName=chrome, platform=WIN10}]]){"_comment" : "Configuration for Hub - hubConfig.json",
"host": Jenkins IP,
"maxSessions": 5,
"port": 4444,
"cleanupCycle": 5000,
"timeout": 300000,
"newSessionWaitTimeout": -1,
"servlets": [],
"prioritizer": null,
"capabilityMatcher": "org.openqa.grid.internal.utils.DefaultCapabilityMatcher",
"throwOnCapabilityNotPresent": true,
"nodePolling": 180000,
"platform": "WINDOWS"}{
"capabilities":
[
{
"browserName": "chrome",
"maxInstances": 2,
"seleniumProtocol": "WebDriver",
"webdriver.chrome.driver": "C:/Program Files (x86)/Google/Chrome/Application/chrome.exe"
},
],
"configuration":
{
"proxy": "org.openqa.grid.selenium.proxy.DefaultRemoteProxy",
"maxSession": 5,
"port": 5555,
"host": Windows node IP,
"register": true,
"registerCycle": 5000,
"hubPort": 4444,
"hubHost": Jenkins IP
}
}public class RemoteWebDriverFactory {
public static final String SELENIUM_HUB = "http://Jenkins_machine:4444/wd/hub";
public static RemoteWebDriver driver = null;
public static BrowserMobProxy proxy = new BrowserMobProxyServer();
static org.openqa.selenium.net.NetworkUtils utils = new org.openqa.selenium.net.NetworkUtils();
static InetAddress nonLoopBackInet = utils.getIp4NonLoopbackAddressOfThisMachine();
public static void setupDriver() throws MalformedURLException {
proxy.start(4455, nonLoopBackInet);
String browser = ConfigParser.getBrowser();
Proxy seleniumProxy = ClientUtil.createSeleniumProxy(proxy);
if (browser.equalsIgnoreCase("chrome")) {
DesiredCapabilities capability = new DesiredCapabilities();
capability.setCapability(CapabilityType.PROXY, seleniumProxy);
capability.setBrowserName("chrome");
capability.setPlatform(Platform.WIN10);
System.setProperty("webdriver.chrome.driver", "/usr/bin/google-chrome");
remoteWebDriver(capability, new URL(SELENIUM_HUB));
} else {
DesiredCapabilities capability = new DesiredCapabilities();
capability.setBrowserName("firefox");
capability.setPlatform(Platform.WIN10);
remoteWebDriver(capability, new URL(SELENIUM_HUB));
}
setupBrowser(driver);
}
private static void remoteWebDriver(DesiredCapabilities capability, URL remoteAddress) {
driver = new RemoteWebDriver(remoteAddress, capability);
}
private static void setupBrowser(WebDriver driver) {
driver.manage().window().setPosition(new Point(0, 0));
driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
}
public static WebDriver getWebDriver() throws MalformedURLException {
if (driver == null) {
setupDriver();
}
return driver;
}
}
To unsubscribe from this group and stop receiving emails from it, send an email to browsermob-pro...@googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to browsermob-proxy+unsubscribe@googlegroups.com.