Can I setup Selenium proxy in Pytest?
Hi Mark,
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 Chrome_Options();
if (!string.IsNullOrWhiteSpace(proxy.HttpProxy))
{
options.Add_AdditionalCapability(CapabilityType.Proxy, proxy);
}
return new Chrome_Driver(driverFolder, options);
}