Example usage for org.openqa.selenium Proxy getProxyAutoconfigUrl

List of usage examples for org.openqa.selenium Proxy getProxyAutoconfigUrl

Introduction

In this page you can find the example usage for org.openqa.selenium Proxy getProxyAutoconfigUrl.

Prototype

public String getProxyAutoconfigUrl() 

Source Link

Document

Gets the proxy auto-configuration URL.

Usage

From source file:com.opera.core.systems.OperaProxy.java

License:Apache License

/**
 * Parse an instance of {@link Proxy}, merge and apply its configuration to the current Opera
 * instance./*from w ww  . j av a 2  s  . c  o m*/
 */
public void parse(Proxy proxy) {
    if (proxy.getProxyType() == Proxy.ProxyType.UNSPECIFIED) {
        return;
    }

    reset();

    switch (proxy.getProxyType()) {
    case DIRECT:
        if (!product.is(MOBILE)) {
            setEnabled(false);
        }
        setUsePAC(false);
        break;

    case MANUAL:
        if (!product.is(MOBILE)) {
            setEnabled(true);
        }
        setUsePAC(false);

        // TODO(andreastt): HTTPS proxy
        // TODO(andreastt): SOCKS proxy

        if (proxy.getHttpProxy() != null) {
            setHttpProxy(proxy.getHttpProxy());
        }
        if (proxy.getFtpProxy() != null) {
            setFtpProxy(proxy.getFtpProxy());
        }

        break;

    case PAC:
        if (!product.is(MOBILE)) {
            setEnabled(true);
        }
        setUsePAC(true);

        if (proxy.getProxyAutoconfigUrl() != null) {
            setAutoconfigUrl(proxy.getProxyAutoconfigUrl());
        }

        break;

    default:
        logger.warning("Unsupported proxy type: " + proxy.getProxyType());
    }
}