C#Selenium Webdriver-如何使用代理验证?
当我使用身份验证运行时,该程序会出现错误。
var options = new FirefoxOptions();
string proxyInfo = "user:password@host:port";
var proxy = new Proxy
{
HttpProxy = proxyInfo,
SslProxy = proxyInfo,
FtpProxy = proxyInfo,
};
options.Proxy = proxy;
var service = FirefoxDriverService.CreateDefaultService();
service.FirefoxBinaryPath = "C:\\Program Files\\Mozilla Firefox\\firefox.exe";
WebDriver = new FirefoxDriver(service, options);
截屏 在此处输入图像描述
当我在没有身份验证的情况下运行它时,该程序可以工作。它仅在打开网站时要求进行身份验证。
var options = new FirefoxOptions();
string proxyInfo = "host:port";
var proxy = new Proxy
{
HttpProxy = proxyInfo,
SslProxy = proxyInfo,
FtpProxy = proxyInfo,
};
options.Proxy = proxy;
var service = FirefoxDriverService.CreateDefaultService();
service.FirefoxBinaryPath = "C:\\Program Files\\Mozilla Firefox\\firefox.exe";
WebDriver = new FirefoxDriver(service, options);
截屏 在这里输入图像描述
我应该如何解决此问题?
The program gives an error when I run it with authentication.
var options = new FirefoxOptions();
string proxyInfo = "user:password@host:port";
var proxy = new Proxy
{
HttpProxy = proxyInfo,
SslProxy = proxyInfo,
FtpProxy = proxyInfo,
};
options.Proxy = proxy;
var service = FirefoxDriverService.CreateDefaultService();
service.FirefoxBinaryPath = "C:\\Program Files\\Mozilla Firefox\\firefox.exe";
WebDriver = new FirefoxDriver(service, options);
Screenshot
enter image description here
The program works when I run it without authentication. It only asks for authentication when the website is opened.
var options = new FirefoxOptions();
string proxyInfo = "host:port";
var proxy = new Proxy
{
HttpProxy = proxyInfo,
SslProxy = proxyInfo,
FtpProxy = proxyInfo,
};
options.Proxy = proxy;
var service = FirefoxDriverService.CreateDefaultService();
service.FirefoxBinaryPath = "C:\\Program Files\\Mozilla Firefox\\firefox.exe";
WebDriver = new FirefoxDriver(service, options);
Screenshot
enter image description here
How should I go about solving this problem?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论