Skip to content

Providing Proxy Authentication For Selenium Web Driver (All Proxy Types)

License

Notifications You must be signed in to change notification settings

mahdibland/Selenium-Proxy-Authentication.Firefox

Repository files navigation

Selenium Proxy Authentication For Firefox

Easily add your auth proxies to your Firefox (Gecko) Driver with one line of code With Extension

Installation

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

Install-Package SeleniumProxyAuthentication.Firefox -Version 1.0.0

! You need to download the "Nightly" or "Developer Edition" of firefox to use this library because in the original browser extensions should be verified before installing since version 43

How to Use it

  • First you need to download the gecko driver from here (make sure that the version of your firefox browser should be match with the version of gecko driver that you download!)
https://github.com/mozilla/geckodriver/releases
  • Then put the geckodriver.exe in your project bin directory

  • Create a new Instance of FirefoxOptions and define the FirefoxProfile (if path of profile not set it will generate the profile randomly)

private static readonly FirefoxOptions FirefoxOptions = new() {Profile = new FirefoxProfile()};
  • Pass the FirefoxOptions Instance to a new Instance of FirefoxDriver
IWebDriver driver = new FirefoxDriver(FirefoxOptions);
  • Attach your proxy to the instance of firefox driver using extension method "AddProxyAuthenticationExtension"
driver.AddProxyAuthenticationExtension(new SeleniumProxyAuthentication.Proxy(
                    ProxyProtocols.HTTP,
                    "host:port:username:password"
                    ));

driver.Navigate().GoToUrl(new Uri("https://github.com/"));
Thread.Sleep(5000);
driver.Quit();
  • Remove Entire Cache That Created By Extensions using this method
driver.DeleteExtensionsCache();

Guides

Proxy Format

  • Support all kind of proxy types (i tested http/s, socks5)
  • Host:Port:Username:Password
  • Host:Port

Licence

License

About

Providing Proxy Authentication For Selenium Web Driver (All Proxy Types)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages