为WebDriver 设置proxy(IE设置代理)


IE driver 


String PROXY = "http://proxy:8083";
        org.openqa.selenium.Proxy proxy = new org.openqa.selenium.Proxy();
        proxy.setHttpProxy(PROXY)
             .setFtpProxy(PROXY)
             .setSslProxy(PROXY);
 

        DesiredCapabilities ds = DesiredCapabilities.internetExplorer();
        ds.setCapability(InternetExplorerDriver.INTRODUCE_FLAKINESS_BY_IGNORING_SECURITY_DOMAINS, true);
        ds.setCapability("ignoreProtectedModeSettings", true);
        ds.setCapability(CapabilityType.PROXY, proxy);
        WebDriver driver = new InternetExplorerDriver(ds);

效果:

 

posted @ 2015-07-26 18:06  to be crazy  阅读(4442)  评论(0编辑  收藏  举报