Example usage for org.openqa.selenium.ie InternetExplorerDriver IE_USE_PRE_PROCESS_PROXY

List of usage examples for org.openqa.selenium.ie InternetExplorerDriver IE_USE_PRE_PROCESS_PROXY

Introduction

In this page you can find the example usage for org.openqa.selenium.ie InternetExplorerDriver IE_USE_PRE_PROCESS_PROXY.

Prototype

String IE_USE_PRE_PROCESS_PROXY

To view the source code for org.openqa.selenium.ie InternetExplorerDriver IE_USE_PRE_PROCESS_PROXY.

Click Source Link

Usage

From source file:org.zaproxy.zap.extension.selenium.ExtensionSelenium.java

License:Apache License

private static WebDriver getWebDriverImpl(Browser browser, String proxyAddress, int proxyPort) {
    DesiredCapabilities capabilities = new DesiredCapabilities();
    if (proxyAddress != null) {
        String httpProxy = proxyAddress + ":" + proxyPort;
        Proxy proxy = new Proxy();
        proxy.setHttpProxy(httpProxy);/*from  w w  w  . j  av a  2 s.  c o m*/
        proxy.setSslProxy(httpProxy);
        capabilities.setCapability(CapabilityType.PROXY, proxy);
    }

    switch (browser) {
    case CHROME:
        return new ChromeDriver(capabilities);
    case FIREFOX:
        return new FirefoxDriver(capabilities);
    case HTML_UNIT:
        return new HtmlUnitDriver(capabilities);
    case INTERNET_EXPLORER:
        capabilities.setCapability(InternetExplorerDriver.IE_USE_PRE_PROCESS_PROXY, true);

        return new InternetExplorerDriver(capabilities);
    /* No longer supported in the Selenium standalone jar
     * need to decide if we support older Opera versions 
    case OPERA:
    OperaDriver driver = new OperaDriver(capabilities);
    if (proxyAddress != null) {
        driver.proxy().setProxyLocal(true);
        // XXX Workaround, in operadriver <= 1.5 the HTTPS proxy settings are not set according to desired capabilities
        // For more details see OperaProxy.parse(Proxy)
        driver.proxy().setHttpsProxy(proxyAddress + ":" + proxyPort);
    }
            
    return driver;
    */
    case PHANTOM_JS:
        final ArrayList<String> cliArgs = new ArrayList<>(4);
        cliArgs.add("--ssl-protocol=any");
        cliArgs.add("--ignore-ssl-errors=yes");

        cliArgs.add("--webdriver-logfile=" + Constant.getZapHome() + "/phantomjsdriver.log");
        cliArgs.add("--webdriver-loglevel=WARN");

        capabilities.setCapability(PhantomJSDriverService.PHANTOMJS_CLI_ARGS, cliArgs);

        return new PhantomJSDriver(capabilities);
    case SAFARI:
        return new SafariDriver(capabilities);
    default:
        throw new IllegalArgumentException("Unknown browser: " + browser);
    }
}