-
Notifications
You must be signed in to change notification settings - Fork 1
/
Program.cs
35 lines (32 loc) · 1.11 KB
/
Program.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
using OpenQA.Selenium;
using OpenQA.Selenium.Chrome;
using OpenQA.Selenium.Firefox;
namespace SeleniumProxyAuthentication.Sample
{
public record Program
{
private static readonly FirefoxOptions FirefoxOptions = new() {Profile = new FirefoxProfile()};
public static void Main()
{
IWebDriver driver = new FirefoxDriver(FirefoxOptions);
try
{
//with proxy credential
driver.AddProxyAuthenticationExtension(new Proxy(ProxyProtocols.HTTP, "209.127.191.180:9279:iazgeluc:buxw7bzlke0x"));
////without proxy credential
//(driver as FirefoxDriver)?.AddProxyAuthenticationExtension(new Proxy(ProxyProtocols.HTTP, "proxy_server:proxy_port"));
driver.Navigate().GoToUrl(new Uri("https://github.com/"));
Thread.Sleep(5000);
driver.Quit();
}
catch (Exception e)
{
Console.WriteLine(e);
}
finally
{
driver.DeleteExtensionsCache();
}
}
}
}