Skip to content

Instantly share code, notes, and snippets.

@FriendlyTester
Created October 16, 2014 11:16
Show Gist options
  • Star 6 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save FriendlyTester/79e7d61ce418ed24cedb to your computer and use it in GitHub Desktop.
Save FriendlyTester/79e7d61ce418ed24cedb to your computer and use it in GitHub Desktop.
C# - Proxy Using ChromeDriver
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");
}
Copy link

ghost commented Jan 28, 2017

Thank you so much.

@d668
Copy link

d668 commented Mar 4, 2017

what about username/password?

@gcfernando
Copy link

gcfernando commented Jun 24, 2018

Refer

[https://stackoverflow.com/questions/27730306/setting-a-proxy-for-chrome-driver-in-selenium]

@Dxesto
Copy link

Dxesto commented Nov 2, 2018

Thank you!

@sammirzagharcheh
Copy link

Very nice and clear sample.
Thank you so much.

@i7solar
Copy link

i7solar commented Sep 5, 2020

This doesn't work

@i7solar
Copy link

i7solar commented Sep 5, 2020

Very nice and clear sample.
Thank you so much.

Liar

@jcardonne
Copy link

This doesn't work

I confirm, that doesn't work unfortunatly...

@WatchDogsDev
Copy link

WatchDogsDev commented Jun 4, 2021

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