Answer the question
In order to leave comments, you need to log in
How to run Selenium Webdriver with proxy [C#]?
Hello.
I tried a lot of ways to run PhantomJS or ChromeDriver under a proxy, but all to no avail - web pages do not load.
If you have already implemented similar functionality - please help. Thank you all in advance for your replies.
Answer the question
In order to leave comments, you need to log in
What exactly have you tried?
And why didn't the option work then:
ChromeOptions options = new ChromeOptions();
options.AddArguments("--proxy-server=http://user:[email protected]:8080");
IWebDriver Driver = new ChromeDriver(options);
Use this ( https://github.com/RDavydenko/OpenQA.Selenium.Chro... )
Install the NuGet package:
Install-Package OpenQA.Selenium.Chrome.ChromeDriverExtensions -Version 1.1.0
using OpenQA.Selenium;
using OpenQA.Selenium.Chrome;
using OpenQA.Selenium.Chrome.ChromeDriverExtensions;
...
var options = new ChromeOptions();
// Добавь свой HTTP-Proxy
options.AddHttpProxy(PROXY_HOST, PROXY_PORT, PROXY_USER, PROXY_PASSWORD);
var driver = new ChromeDriver(options); // или new ChromeDriver(AppDomain.CurrentDomain.BaseDirectory, options);
driver.Navigate().GoToUrl("https://whatismyipaddress.com/"); // Проверь свой IP
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question