iewebdriverserver。 Internet Explorer更改系统代理而不是浏览器代理

时间:2018-03-06 08:27:56

标签: c# selenium internet-explorer selenium-webdriver webdriver

IE更改系统代理而不是浏览器代理,会出现什么问题? 我尝试更改属性UsePerProcessProxy,但它没有修复它。 请参阅以下代码

public InternetExplorerOptions GetOptions()
        {
            InternetExplorerOptions options = new InternetExplorerOptions
            {
                IntroduceInstabilityByIgnoringProtectedModeSettings = true,
                InitialBrowserUrl = "about:blank",
                EnableNativeEvents = true,
                EnsureCleanSession = true,
                EnablePersistentHover = false,
                PageLoadStrategy = InternetExplorerPageLoadStrategy.Normal,
            };

            options.UsePerProcessProxy = true;
            options.Proxy = GetProxy();
            return options;
        }

 public override IWebDriver CreateRemoteDriver()
        {
            var options = GetOptions();
            foreach (var capability in CapabilityProperties)
            {
                options.AddAdditionalCapability(capability.Name, capability.Value);
            }
            return new RemoteWebDriver(new Uri(GridUri), options.ToCapabilities());
        }
 public Proxy GetProxy()
        {
            if (Proxy != null || ProxyAutoConfigUrl != null)
            {
                var proxy = new Proxy();
                proxy.AddBypassAddresses("localhost", "127.0.0.1");

                if (ProxyAutoConfigUrl != null)
                {
                    proxy.Kind = ProxyKind.ProxyAutoConfigure;
                    proxy.ProxyAutoConfigUrl = ProxyAutoConfigUrl;
                }
                if (Proxy != null)
                {
                    proxy.Kind = ProxyKind.Manual;
                    proxy.HttpProxy = Proxy;
                    proxy.SslProxy = Proxy;
                }
                return proxy;
            }
            return null;
        }

Selenium Standalone Server 3.10.0版 iewebdriverserver 3.9.0 32位

0 个答案:

没有答案