Installing a proxy for Chrome Driver in Selenium

I am using Selenium Webdriver using C # to automate in the Chrome browser. I need to check if my webpage is blocked in some regions (some ip ranges). Therefore, I have to install the proxy server in the Chrome browser. I tried the code below. The proxy is installed, but I get an error. Can someone help me.

        ChromeOptions options = new ChromeOptions();

        options.AddArguments("--proxy-server=XXX.XXX.XXX.XXX");

        IWebDriver Driver = new ChromeDriver(options);

        Driver.Navigate().GoToUrl("myUrlGoesHere");

When I run this code, I get the following message in my Chrome browser: I tried to enable the proxy option, but the "Change proxy settings" option was disabled.

* Unable to connect to proxy server

A proxy server is a server that acts as an intermediary between your computer and other servers. Your system is now configured to use a proxy server, but Google Chrome cannot connect to it. If you are using a proxy server ... Check the proxy server settings or contact your network administrator to verify that the proxy server is working. If you do not believe that you should use a proxy server: go to the Chrome menu> Settings> Show advanced settings ...> Change proxy server settings ...> LAN settings and uncheck "Use a proxy server for your local network. " Error code: ERR_PROXY_CONNECTION_FAILED *

+4
2

nuget Selenium 2.50.1 :

ChromeOptions options = new ChromeOptions();
proxy = new Proxy();
proxy.Kind = ProxyKind.Manual;
proxy.IsAutoDetect = false;
proxy.HttpProxy =
proxy.SslProxy = "127.0.0.1:3330";
options.Proxy = proxy;
options.AddArgument("ignore-certificate-errors");
var chromedriver = new ChromeDriver(options);
+5

- , / , :

options.AddArguments("--proxy-server=http://user:password@yourProxyServer.com:8080");
+4

Source: https://habr.com/ru/post/1569606/


All Articles