How to setup a Selenium proxy in SpecFlow?
Hi Dipen,
You can refer to the sample code below in setting up Selenium proxy:
/// <summary>
/// Performs the initialize of the browser.
/// </summary>
/// <param name="driverFolder">The driver folder.</param>
/// <param name="proxy">The proxy.</param>
/// <returns>
/// The web driver.
/// </returns>
protected override IWebDriver PerformInitialize(string driverFolder, Proxy proxy)
{
var options = new ChromeOptions();
if (!string.IsNullOrWhiteSpace(proxy.HttpProxy))
{
options.AddAdditionalCapability(CapabilityType.Proxy, proxy);
}
return new ChromeDriver(driverFolder, options);
}