1

I want to configure the proxy settings for chrome web driver by using selenium 3.141.0 version in c#.

var co = new ChromeOptions();
Proxy proxy = new Proxy();
ProxyIPAddress proxyIP = JsonConvert.DeserializeObject<ProxyIPAddress>(new WebClient().DownloadString(crawler.endPoint + "api/Proxy/GetProxy"));
proxy.Kind = ProxyKind.Manual;
proxy.IsAutoDetect = false;
proxy.HttpProxy =
    proxy.SslProxy = "127.0.0.1:3330";
co.Proxy = proxy;
co.AddArgument("ignore-certificate-errors");
co.AddArguments("--proxy-server=http://user:"+proxyIP.Address+ "/"+ proxyIP.ProxyUserName + "/" + proxyIP.ProxyPassword);
co.AddArgument("headless");
co.AcceptInsecureCertificates = true;
co.PageLoadStrategy = PageLoadStrategy.Normal;

using (var driver = new ChromeDriver(co))
{
    try
    {
        driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(20);

        var wait = new WebDriverWait(driver, TimeSpan.FromSeconds(20));

        wait.Until(wt => !string.IsNullOrWhiteSpace(wt.FindElement(By.Id("root")).Text));

        driver.Navigate().GoToUrl(Obj.URL);
        var readytext = new HtmlDocument();

        readytext.LoadHtml(driver.PageSource);
    }
}
  • 1
    So what goes wrong? – SlightlyKosumi Jun 14 '19 at 6:53
  • I feel like this post isn't a question. Like me posting in stack exchange, "I want to go to the mall. So I will. Bye". Can you turn this into a question? – Asyranok Jun 14 '19 at 14:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.