此代码有效:
var ieOptions = new InternetExplorerOptions();
ieOptions.ForceCreateProcessApi = true;
ieOptions.BrowserCommandLineArguments = "-private";
Proxy proxy = new Proxy()
{
Kind = ProxyKind.Manual,
HttpProxy = "1.1.1.1:8080",
SslProxy = "1.1.1.1:8080",
};
ieOptions.Proxy = proxy;
IWebDriver driver = new InternetExplorerDriver(ieOptions);
此代码不会:
var ieOptions = new InternetExplorerOptions();
ieOptions.ForceCreateProcessApi = true;
ieOptions.BrowserCommandLineArguments = "-private";
Proxy proxy = new Proxy()
{
Kind = ProxyKind.Manual,
SocksProxy = "1.1.1.1:1080",
};
ieOptions.Proxy = proxy;
IWebDriver driver = new InternetExplorerDriver(ieOptions);
检查IE设置和袜子根本就没有填充。 这是一个错误吗?
答案 0 :(得分:1)
我相信你错过了
options.UsePerProcessProxy = true;
options.Proxy = proxy;
IWebDriver driver = new InternetExplorerDriver(options);
强制webdriver
使用proxy
第二段代码不会告诉浏览器在任何地方使用代理。如果您没有指定,driver
将如何知道?