I am having troubles in setting socks proxy for chrome driver
Proxy proxy = new Proxy();
proxy.setProxyType(Proxy.ProxyType.MANUAL);
proxy.setAutodetect(false);
proxy.setSocksProxy(ProxyHelper.PROXY_HOST + ":" + ProxyHelper.PROXY_PORT);
DesiredCapabilities capabilities = DesiredCapabilities.chrome();
capabilities.setCapability(CapabilityType.PROXY, proxy);
WebDriver chromeDriver = new ChromeDriver(capabilities);
This configuration gives:
Exception in thread "main" org.openqa.selenium.WebDriverException: unknown error: cannot parse capability: proxy from unknown error: proxyType is 'manual' but no manual proxy capabilities were found
I think it expects me to fill http, ftp and ssl proxies. But if I fill them; error doesnt raise but my proxy does not work properly too as it tries to use it like http proxy rather than socks proxy.
What can I do?
Setting up a Proxy ServerImport Selenium WebDriver from the package. Define the proxy server (IP:PORT) Set ChromeOptions() Add the proxy server argument to the options.
What Is a SOCKS Proxy? SOCKS, which stands for Socket Secure, is a network protocol that facilitates communication with servers through a firewall by routing network traffic to the actual server on behalf of a client. SOCKS is designed to route any type of traffic generated by any protocol or program.
ChromeOptions options = new ChromeOptions();
options.add_argument("--proxy-server=socks5://" + host + ":" + port);
WebDriver driver = new ChromeDriver(options);
Have you tried using this chromium arg?
--proxy-server="socks5://host:port"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With