При создании WebDriver через RemoteWebDriver не выставляются настройки прокси сервера они просто игнорируются
Вот пример кода:
String PROXY = "192.168.1.100:" + port; Proxy proxy = new Proxy(); proxy.setHttpProxy(PROXY); DesiredCapabilities capabilities = new DesiredCapabilities(); сapabilities = DesiredCapabilities.internetExplorer(); capabilities.setCapability(CapabilityType.PROXY, proxy); // start the browser up driver = new RemoteWebDriver(new URL("http://192.168.1.100:4444/wd/hub"), capabilities); //.... driver.get("http://facebook.com");
Повторюсь, нет проблем если драйвер создать так
WebDriver driver = new ChromeDriver(capabilities);
что-то похоже на вот эту проблему https://code.google..../detail?id=2051
Как правильно выставить прокси через RemoteWebdriver для FF, Chrome и IE
Спасибо.
есть вот такой обходной путь но книму не хочу прибегать.
DesiredCapabilities capabilities = new DesiredCapabilities(); //------CHROME------ ChromeOptions options = new ChromeOptions(); options.addArguments("--proxy-server=http://" + PROXY); capabilities.setCapability(ChromeOptions.CAPABILITY, options); //----FIREFOX--------------- FirefoxProfile profile = new FirefoxProfile(); profile.setPreference("network.proxy.type", 1); profile.setPreference("network.proxy.http", "192.168.1.100"); profile.setPreference("network.proxy.http_port", port); capabilities.setCapability(FirefoxDriver.PROFILE, profile);