Selenium WebDriver 3.0.1 chromedriver.exe 2.25 --whitelisted-ips=""

google-chrome, http-proxy, java, selenium-chromedriver, selenium-webdriver

Solution

All answers with `addArguments("--whitelisted-ips=''");` are wrong. This argument needs to be injected into chromedriver exe, not chrome.

If you use ChromeDriver loccaly directly from code, just insert lines below before ChromeDriver init

    System.setProperty("webdriver.chrome.whitelistedIps", "");

If you use it remotely (eg. Selenium hub/grid) you need to setup system property when node is run like in command:

java -Dwebdriver.chrome.whitelistedIps= testClass

or docker by passing JAVA_OPTS env

  chrome:
    image: selenium/node-chrome:3.141.59
    container_name: chrome
    depends_on:
      - selenium-hub
    environment:
      - HUB_HOST=selenium-hub
      - HUB_PORT=4444
      - JAVA_OPTS=-Dwebdriver.chrome.whitelistedIps=

Problem

I would like to have a solution that is able to open a chrome browser and able to open a url through a proxy. I decided to use the followings: Selenium WebDriver 3.0.1 with Java 1.8.0_111-b14 chromedriver.exe 2.25 I'm facing with a weird issue: "Only local connections are allowed." Please see the cause of my confusion Please see my code: ``` package seleniumFiles; import java.util.Arrays; import org.openqa.selenium.WebDriver; import org.openqa.selenium.chrome.*; import org.openqa.selenium.remote.DesiredCapabilities; public class SeleniumClass { public static void main(String[] args) { System.setProperty("webdriver.chrome.driver", "C:\\work\\selenium-java-3.0.1\\chromedriver.exe"); DesiredCapabilities capabilities = DesiredCapabilities.chrome(); capabilities.setCapability("network.proxy.http", "93.180.7.246"); capabilities.setCapability("network.proxy.http_port", "8080"); capabilities.setCapability("webdriver.chrome.args", Arrays.asList("--verbose --whitelisted-ips=''")); WebDriver driver = new ChromeDriver(capabilities); driver.get("http://www.whoishostingthis.com/tools/user-agent/"); } } ``` Running the "chromedriver.exe --verbose --whitelisted-ips=''" in cmd sais "Remote connections are allowed by a whitelist <''>" It seems like works but I cannot figure out what I did wrong in the code. Any idea or suggestion appreciated.

Original source

Related problems