org.openqa.selenium
Class Proxy

java.lang.Object
  extended by org.openqa.selenium.Proxy

public class Proxy
extends Object

Configuration parameters for using proxies in WebDriver. Generally you should pass an object of this type to a WebDriver constructor, or in some cases to the profile object used in the WebDriver construction. For simplicity, setting values here commits the proxy to a certain configuration. That is, it is an error to set an httpProxy manually and then turn on proxy autodetect.


Nested Class Summary
static class Proxy.ProxyType
           
 
Constructor Summary
Proxy()
           
Proxy(Map<String,?> raw)
           
 
Method Summary
 String getFtpProxy()
          Gets the FTP proxy.
 String getHttpProxy()
          Gets the HTTP proxy.
 String getHttpsProxy()
          Gets the HTTPS proxy.
 String getNoProxy()
           
 String getProxyAutoconfigUrl()
          Gets the proxy auto-configuration URL.
 Proxy.ProxyType getProxyType()
          Gets the Proxy.ProxyType.
 String getSocksPassword()
          Gets the SOCKS proxy's password.
 String getSocksProxy()
          Gets the SOCKS proxy.
 String getSocksUsername()
          Gets the SOCKS proxy's username.
 String getSslProxy()
          Gets the SSL tunnel proxy.
 boolean isAutodetect()
          Whether to autodetect proxy settings.
 Proxy setAutodetect(boolean autodetect)
          Specifies whether to autodetect proxy settings.
 Proxy setFtpProxy(String ftpProxy)
          Specify which proxy to use for FTP connections.
 Proxy setHttpProxy(String httpProxy)
          Specify which proxy to use for HTTP connections.
 Proxy setHttpsProxy(String httpsProxy)
          Specify which proxy to use for HTTPS connections.
 Proxy setNoProxy(String noProxy)
           
 Proxy setProxyAutoconfigUrl(String proxyAutoconfigUrl)
          Specifies the URL to be used for proxy auto-configuration.
 Proxy setProxyType(Proxy.ProxyType proxyType)
          Explicitly sets the proxy type, useful for forcing direct connection on Linux.
 void setSocksPassword(String password)
          Specifies a password for the SOCKS proxy.
 Proxy setSocksProxy(String socksProxy)
          Specifies which proxy to use for SOCKS.
 void setSocksUsername(String username)
          Specifies a username for the SOCKS proxy.
 Proxy setSslProxy(String sslProxy)
          Specify which proxy to use for SSL connections.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Proxy

public Proxy()

Proxy

public Proxy(Map<String,?> raw)
Method Detail

getProxyType

public Proxy.ProxyType getProxyType()
Gets the Proxy.ProxyType. This can signal if set to use a direct connection (without proxy), manually set proxy settings, auto-configured proxy settings, or whether to use the default system proxy settings. It defaults to Proxy.ProxyType.UNSPECIFIED.

Returns:
the proxy type employed

setProxyType

public Proxy setProxyType(Proxy.ProxyType proxyType)
Explicitly sets the proxy type, useful for forcing direct connection on Linux.

Returns:
reference to self

isAutodetect

public boolean isAutodetect()
Whether to autodetect proxy settings.

Returns:
true if set to autodetect proxy settings, false otherwise

setAutodetect

public Proxy setAutodetect(boolean autodetect)
Specifies whether to autodetect proxy settings.

Parameters:
autodetect - set to true to use proxy auto detection, false to leave proxy settings unspecified
Returns:
reference to self

getFtpProxy

public String getFtpProxy()
Gets the FTP proxy.

Returns:
the FTP proxy hostname if present, or null if not set

setFtpProxy

public Proxy setFtpProxy(String ftpProxy)
Specify which proxy to use for FTP connections.

Parameters:
ftpProxy - the proxy host, expected format is hostname.com:1234
Returns:
reference to self

getHttpProxy

public String getHttpProxy()
Gets the HTTP proxy.

Returns:
the HTTP proxy hostname if present, or null if not set

setHttpProxy

public Proxy setHttpProxy(String httpProxy)
Specify which proxy to use for HTTP connections.

Parameters:
httpProxy - the proxy host, expected format is hostname:1234
Returns:
reference to self

getHttpsProxy

public String getHttpsProxy()
Gets the HTTPS proxy.

Returns:
the HTTPS proxy hostname if present, or null if not set

setHttpsProxy

public Proxy setHttpsProxy(String httpsProxy)
Specify which proxy to use for HTTPS connections.

Parameters:
httpsProxy - the proxy host, expected format is hostname:1234
Returns:
reference to self

getNoProxy

public String getNoProxy()

setNoProxy

public Proxy setNoProxy(String noProxy)

getSslProxy

public String getSslProxy()
Gets the SSL tunnel proxy.

Returns:
the SSL tunnel proxy hostname if present, null otherwise

setSslProxy

public Proxy setSslProxy(String sslProxy)
Specify which proxy to use for SSL connections.

Parameters:
sslProxy - the proxy host, expected format is hostname.com:1234
Returns:
reference to self

getSocksProxy

public String getSocksProxy()
Gets the SOCKS proxy.

Returns:
the SOCKS proxy if present, null otherwise

setSocksProxy

public Proxy setSocksProxy(String socksProxy)
Specifies which proxy to use for SOCKS. Currently only supported in com.opera.core.systems.OperaDriver.

Parameters:
socksProxy - the proxy host, expected format is hostname.com:1234
Returns:
reference to self

getSocksUsername

public String getSocksUsername()
Gets the SOCKS proxy's username. Supported by SOCKS v5 and above.

Returns:
the SOCKS proxy's username

setSocksUsername

public void setSocksUsername(String username)
Specifies a username for the SOCKS proxy. Supported by SOCKS v5 and above.

Parameters:
username - username for the SOCKS proxy

getSocksPassword

public String getSocksPassword()
Gets the SOCKS proxy's password. Supported by SOCKS v5 and above.

Returns:
the SOCKS proxy's password

setSocksPassword

public void setSocksPassword(String password)
Specifies a password for the SOCKS proxy. Supported by SOCKS v5 and above.

Parameters:
password - password for the SOCKS proxy

getProxyAutoconfigUrl

public String getProxyAutoconfigUrl()
Gets the proxy auto-configuration URL.

Returns:
the proxy auto-configuration URL

setProxyAutoconfigUrl

public Proxy setProxyAutoconfigUrl(String proxyAutoconfigUrl)
Specifies the URL to be used for proxy auto-configuration. Expected format is http://hostname.com:1234/pacfile. This is required if getProxyType() is set to Proxy.ProxyType.PAC, ignored otherwise.

Parameters:
proxyAutoconfigUrl - the URL for proxy auto-configuration
Returns:
reference to self


Copyright © 2012. All Rights Reserved.