Search code examples
javaselenium-webdriverwebdriver

How to use socks5 proxy login and password selenium


I would like to connect via selenium to socks5 proxy but it does not want to accept login and password please help me please in solving this problem.

My code:

    System.setProperty("webdriver.chrome.driver", "chromedriver.exe");
  String address = "207.244.217.165:6712";
ChromeOptions options = new ChromeOptions();

  Proxy proxy = new Proxy();
  proxy.setSocksVersion(5);
 proxy.setSocksProxy(address).setSocksUsername("xcvbdfbedf").setSocksPassword("xcvbdfbedf");
 options.setProxy(proxy);

 WebDriver driver = new ChromeDriver(options);

driver.get("https://2ip.ru/");

Solution

  • Since crbug#40323993, socks5 is not supported by Chrome. The only way to make this work natively, would be to patch the source at Chromium.

    You might however use some middleware, such as a proxy to forward socks to http