Skip to content

mahdibland/Selenium-Proxy-Authentication.Chrome

Repository files navigation

Selenium Proxy Authentication For Chrome

Easily add your auth proxies to your chrome Driver with one line of code With Extension

Installation

You Can Simply Add this Library to your project with Nuget Package:

Install-Package SeleniumProxyAuthentication.Chrome -Version 2.1.1

Limitations

Currently this library not working in the incognito browser mode

  • i'm working on it and release a new version when it's completed

How to Use it

  • First you need to download the chrome driver from here (make sure that the version of your chrome browser should be match with the version of chrome driver that you download!)
https://chromedriver.chromium.org/downloads
  • Then put the chromedriver.exe in your project directory

  • Create a global chrome option

private static readonly ChromeOptions ChromeOptions = new();
  • Attach your proxy to the chrome option using the extension method that comes with nuget package
ChromeOptions.AddProxyAuthenticationExtension(new SeleniumProxyAuthentication.Proxy(
                    ProxyProtocols.HTTP,
                    "host:port:username:password"
                    ));
  • Cretae chrome driver and use the chrome option
IWebDriver driver = new ChromeDriver(ChromeOptions);
driver.Navigate().GoToUrl(new Uri("https://github.com"));
  • Remove Entire Cache That Created By Extensions (In the Dispose Function)
chromeOptions.DeleteExtensionsCache();

Guides

Proxy Format

  • ✅ Host:Port:Username:Password
  • ✅ Host:Port

Licence

License FOSSA Status

FOSSA Status