简体   繁体   English

提供代理的用户名和密码 - Selenium

[英]Provide username and password for proxy - Selenium

I'm trying the below code. 我正在尝试下面的代码。 But its still giving dialog box for entering username and password when firefox browser starts. 但是当firefox浏览器启动时,它仍然提供用于输入用户名和密码的对话框。 Where am I wrong? 我哪里错了?

FirefoxProfile profile = new FirefoxProfile();
Proxy firefox_proxy = new Proxy();
firefox_proxy.HttpProxy = proxy;
firefox_proxy.SslProxy = proxy;
profile.SetProxyPreferences(firefox_proxy);

Firefoxdriver driver = new FirefoxDriver(new FirefoxBinary(), profile, TimeSpan.FromMinutes(3));
driver.Navigate().GoToUrl("http://" + proxy_username + ":" + proxy_password + "@www.xyz.com/");

You should try with https:// instead of http:// as on some sites the Basic Authentication works on secure network only. 您应该尝试使用https://而不是http://因为在某些站点上,基本身份验证仅适用于安全网络。

Syntax: driver.Navigate().GoToUrl("https://proxy_username:proxy_password@www.xyz.com/"); 语法: driver.Navigate().GoToUrl("https://proxy_username:proxy_password@www.xyz.com/");

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM