[英]Trying to Use Proxy in C# using Selenium but having issues
this is my code currently.这是我目前的代码。
ChromeOptions options = new ChromeOptions();
Proxy proxy = new Proxy();
proxy.Kind = ProxyKind.Manual;
proxy.IsAutoDetect = false;
proxy.SslProxy = "Ip is here:port here";
options.Proxy = proxy;
options.AddArgument("ignore-certificate-errors");
IWebDriver driver = new ChromeDriver(options);
driver.Navigate().GoToUrl("https://www.selenium.dev/");
However, I can't seem to figure out how to insert the proxy authentication credentials.但是,我似乎无法弄清楚如何插入代理身份验证凭据。 I tried a lot of stuff online but can't seem to find the correct direction.
我在网上尝试了很多东西,但似乎找不到正确的方向。
Proxy error:代理错误:
This is where I end up.这就是我结束的地方。
just change the url to this:只需将网址更改为:
var link = "www.selenium.dev";
public void login(String username, String password){
WebDriver driver = getDriver();
String URL = string.Format("http://{0}:{1}@{2}", username, password, link);
driver.get(URL);
driver.manage().window().maximize();
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.