Created
October 16, 2014 11:16
-
-
Save FriendlyTester/79e7d61ce418ed24cedb to your computer and use it in GitHub Desktop.
C# - Proxy Using ChromeDriver
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void SettupUpAProxyUsingChromeDriver() | |
{ | |
//Create a chrome options object | |
var chromeOptions = new ChromeOptions(); | |
//Create a new proxy object | |
var proxy = new Proxy(); | |
//Set the http proxy value, host and port. | |
proxy.HttpProxy = "localhost:8888"; | |
//Set the proxy to the Chrome options | |
chromeOptions.Proxy = proxy; | |
//Then create a new ChromeDriver passing in the options | |
//ChromeDriver path isn't required if its on your path | |
//If it now downloaded it and put the path here | |
var Driver = new ChromeDriver(@"C:\Users\Richard\Desktop\", chromeOptions); | |
//Navigation to a url and a look at the traffic logged in fiddler | |
Driver.Navigate().GoToUrl("http://bbc.co.uk"); | |
} |
what about username/password?
Refer
[https://stackoverflow.com/questions/27730306/setting-a-proxy-for-chrome-driver-in-selenium]
Thank you!
Very nice and clear sample.
Thank you so much.
This doesn't work
Very nice and clear sample.
Thank you so much.
Liar
This doesn't work
I confirm, that doesn't work unfortunatly...
As Selenium Docs say you should set SslProxy too.
ChromeOptions options = new ChromeOptions();
Proxy proxy = new Proxy();
proxy.Kind = ProxyKind.Manual;
proxy.IsAutoDetect = false;
proxy.SslProxy = "<HOST:PORT>";
options.Proxy = proxy;
options.AddArgument("ignore-certificate-errors");
IWebDriver driver = new ChromeDriver(options);
driver.Navigate().GoToUrl("https://www.selenium.dev/");
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thank you so much.