Enum HtmlUnitOption
- java.lang.Object
-
- java.lang.Enum<HtmlUnitOption>
-
- org.openqa.selenium.htmlunit.options.HtmlUnitOption
-
- All Implemented Interfaces:
Serializable
,Comparable<HtmlUnitOption>
,HtmlUnitOptionNames
,OptionEnum
public enum HtmlUnitOption extends Enum<HtmlUnitOption> implements HtmlUnitOptionNames, OptionEnum
- Author:
- Scott Babcock, Ronald Brill
-
-
Enum Constant Summary
Enum Constants Enum Constant Description CONNECTION_TIME_TO_LIVE
Sets theconnTimeToLive
(in milliseconds) of theHttpClient
connection pool.CSS_ENABLED
Enables/disables CSS support.DO_NOT_TRACK_ENABLED
Enables/disables "Do Not Track" support.DOWNLOAD_IMAGES
Sets whether or not to automatically download images.FETCH_POLYFILL_ENABLED
Sets whether or not fetch polyfill should be used.FILE_PROTOCOL_FOR_XMLHTTPREQUESTS_ALLOWED
Sets whether or not the file protocol is allowed for XMLHttpRequests.GEOLOCATION_ENABLED
Enables/disables geo-location support.HISTORY_PAGE_CACHE_LIMIT
Sets the maximum number ofpages
to cache in history.HISTORY_SIZE_LIMIT
Sets the maximum number ofpages
to cache in history.HOME_PAGE
Sets the client's home page.IS_REDIRECT_ENABLED
Sets whether or not redirections will be followed automatically on receipt of a redirect status code from the server.JAVASCRIPT_ENABLED
Enables/disables JavaScript support.LOCAL_ADDRESS
Sets the local address to be used for request execution.MAX_IN_MEMORY
Sets the maximum bytes to have in memory, after which the content is saved to a temporary file.
NOTE: Set this to zero or -1 to deactivate the saving at all.POPUP_BLOCKER_ENABLED
Enable/disable the popup window blocker.PRINT_CONTENT_ON_FAILING_STATUS_CODE
Specifies whether or not the content of the resulting document will be printed to the console in the event of a failing response code.PROXY_CONFIG
Sets the proxy configuration for this client.SCREEN_HEIGHT
Sets the screen height.SCREEN_WIDTH
Sets the screen width.SSL_CLIENT_CERTIFICATE_PASSWORD
Password for the specified SSL client certificate KeyStore.SSL_CLIENT_CERTIFICATE_STORE
The SSL client certificate KeyStore to use.SSL_CLIENT_CERTIFICATE_TYPE
Type of the specified SSL client certificate KeyStore (e.g. -jks
orpkcs12
).SSL_CLIENT_CIPHER_SUITES
Sets the cipher suites enabled for use on SSL connections.SSL_CLIENT_PROTOCOLS
Sets the protocol versions enabled for use on SSL connections.SSL_INSECURE_PROTOCOL
Sets the SSL protocol, used only whenUSE_INSECURE_SSL
is set totrue
.SSL_TRUST_STORE
The SSL server certificate trust store.SSL_TRUST_STORE_PASSWORD
Password for the specified SSL trust KeyStore.SSL_TRUST_STORE_TYPE
Type of the specified SSL trust KeyStore (e.g. -jks
orpkcs12
).TEMP_FILE_DIRECTORY
Path to the directory to be used for storing the response content in a temporary file.THROW_EXCEPTION_ON_FAILING_STATUS_CODE
Specifies whether or not an exception will be thrown in the event of a failing status code.THROW_EXCEPTION_ON_SCRIPT_ERROR
Indicates if an exception should be thrown when a script execution fails or if it should be caught and just logged to allow page execution to continue.TIMEOUT
Sets the timeout of theWebConnection
.USE_INSECURE_SSL
If set totrue
, the client will accept connections to any host, regardless of whether they have valid certificates or not.WEB_CLIENT_VERSION
WEB_CLIENT_VERSION(optWebClientVersion, BrowserVersion.class, BrowserVersion.BEST_SUPPORTED).WEB_SOCKET_ENABLED
Enables/disables WebSocket support.WEB_SOCKET_MAX_BINARY_MESSAGE_BUFFER_SIZE
Sets the WebSocketmaxBinaryMessageBufferSize
.WEB_SOCKET_MAX_BINARY_MESSAGE_SIZE
Sets the WebSocketmaxBinaryMessageSize
.WEB_SOCKET_MAX_TEXT_MESSAGE_BUFFER_SIZE
Sets the WebSocketmaxTextMessageBufferSize
.WEB_SOCKET_MAX_TEXT_MESSAGE_SIZE
Sets the WebSocketmaxTextMessageSize
.
-
Field Summary
-
Fields inherited from interface org.openqa.selenium.htmlunit.options.HtmlUnitOptionNames
optConnectionTimeToLive, optCssEnabled, optDoNotTrackEnabled, optDownloadImages, optFetchPolyfillEnabled, optFileProtocolForXMLHttpRequestsAllowed, optGeolocationEnabled, optHistoryPageCacheLimit, optHistorySizeLimit, optHomePage, optIsRedirectEnabled, optJavaScriptEnabled, optLocalAddress, optMaxInMemory, optPopupBlockerEnabled, optPrintContentOnFailingStatusCode, optProxyConfig, optScreenHeight, optScreenWidth, optSslClientCertificatePassword, optSslClientCertificateStore, optSslClientCertificateType, optSslClientCipherSuites, optSslClientProtocols, optSslInsecureProtocol, optSslTrustStore, optSslTrustStorePassword, optSslTrustStoreType, optTempFileDirectory, optThrowExceptionOnFailingStatusCode, optThrowExceptionOnScriptError, optTimeout, optUseInsecureSSL, optWebClientVersion, optWebSocketEnabled, optWebSocketMaxBinaryMessageBufferSize, optWebSocketMaxBinaryMessageSize, optWebSocketMaxTextMessageBufferSize, optWebSocketMaxTextMessageSize, SECTION
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
applyPropertyTo(Map<String,Object> optionsMap)
Object
decode(Object value)
Decode the specified value according to the type of this option.Object
encode(Object value)
Encode the specified value according to the type of this option.static HtmlUnitOption
fromCapabilityKey(String key)
Get the enumerated constant for the specified option key name.static HtmlUnitOption
fromPropertyName(String name)
Get the enumerated constant for the specified system property name.String
getCapabilityKey()
Object
getDefaultValue()
Class<?>
getOptionType()
String
getPropertyName()
void
insert(WebClientOptions options, Object value)
Insert the specified value for this option into the provided web client options object.boolean
isDefaultValue(Object value)
Determine if the specified value matches the default for this option.Object
obtain(WebClientOptions options)
Obtain the value for this option from the specified web client options object.static HtmlUnitOption
valueOf(String name)
Returns the enum constant of this type with the specified name.static HtmlUnitOption[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
WEB_CLIENT_VERSION
public static final HtmlUnitOption WEB_CLIENT_VERSION
WEB_CLIENT_VERSION(optWebClientVersion, BrowserVersion.class, BrowserVersion.BEST_SUPPORTED).
-
JAVASCRIPT_ENABLED
public static final HtmlUnitOption JAVASCRIPT_ENABLED
Enables/disables JavaScript support.property: webdriver.htmlunit.javaScriptEnabled
type:boolean
default:true
-
CSS_ENABLED
public static final HtmlUnitOption CSS_ENABLED
Enables/disables CSS support. If disabled, HtmlUnit will not download linked CSS files and also not trigger the associatedonload
/onerror
events.property: webdriver.htmlunit.cssEnabled
type:boolean
default:true
-
PRINT_CONTENT_ON_FAILING_STATUS_CODE
public static final HtmlUnitOption PRINT_CONTENT_ON_FAILING_STATUS_CODE
Specifies whether or not the content of the resulting document will be printed to the console in the event of a failing response code. Successful response codes are in the range 200-299.property: webdriver.htmlunit.printContentOnFailingStatusCode
type:boolean
default:true
-
THROW_EXCEPTION_ON_FAILING_STATUS_CODE
public static final HtmlUnitOption THROW_EXCEPTION_ON_FAILING_STATUS_CODE
Specifies whether or not an exception will be thrown in the event of a failing status code. Successful status codes are in the range 200-299.property: webdriver.htmlunit.throwExceptionOnFailingStatusCode
type:boolean
default:true
-
THROW_EXCEPTION_ON_SCRIPT_ERROR
public static final HtmlUnitOption THROW_EXCEPTION_ON_SCRIPT_ERROR
Indicates if an exception should be thrown when a script execution fails or if it should be caught and just logged to allow page execution to continue.property: webdriver.htmlunit.throwExceptionOnScriptError
type:boolean
default:true
-
POPUP_BLOCKER_ENABLED
public static final HtmlUnitOption POPUP_BLOCKER_ENABLED
Enable/disable the popup window blocker. By default, the popup blocker is disabled, and popup windows are allowed. When set totrue
, thewindow.open()
function has no effect and returnsnull
.property: webdriver.htmlunit.popupBlockerEnabled
type:boolean
default:false
-
IS_REDIRECT_ENABLED
public static final HtmlUnitOption IS_REDIRECT_ENABLED
Sets whether or not redirections will be followed automatically on receipt of a redirect status code from the server.property: webdriver.htmlunit.isRedirectEnabled
type:boolean
default:true
(enable automatic redirection)
-
TEMP_FILE_DIRECTORY
public static final HtmlUnitOption TEMP_FILE_DIRECTORY
Path to the directory to be used for storing the response content in a temporary file. The specified directory is created if if doesn't exist.property: webdriver.htmlunit.tempFileDirectory
type:File
default:null
(use system default)
see:setMaxInMemory
-
SSL_CLIENT_CERTIFICATE_STORE
public static final HtmlUnitOption SSL_CLIENT_CERTIFICATE_STORE
The SSL client certificate KeyStore to use.NOTE: This option is omitted when serializing session settings. The SSL client certificate key store type is serialized via SSL_CLIENT_CERTIFICATE_TYPE and the SSL client certificate key store password is serialized via SSL_CLIENT_CERTIFICATE_PASSWORD
property: webdriver.htmlunit.sslClientCertificateStore
type:KeyStore
default:null
see:SSL_CLIENT_CERTIFICATE_TYPE
see:SSL_CLIENT_CERTIFICATE_PASSWORD
-
SSL_CLIENT_CERTIFICATE_TYPE
public static final HtmlUnitOption SSL_CLIENT_CERTIFICATE_TYPE
Type of the specified SSL client certificate KeyStore (e.g. -jks
orpkcs12
).property: webdriver.htmlunit.sslClientCertificateType
type: char[]
default:null
see:SSL_CLIENT_CERTIFICATE_STORE
see:SSL_CLIENT_CERTIFICATE_PASSWORD
see:Security.getProviders()
-
SSL_CLIENT_CERTIFICATE_PASSWORD
public static final HtmlUnitOption SSL_CLIENT_CERTIFICATE_PASSWORD
Password for the specified SSL client certificate KeyStore.property: webdriver.htmlunit.sslClientCertificatePassword
type: char[]
default:null
see:SSL_CLIENT_CERTIFICATE_STORE
see:SSL_CLIENT_CERTIFICATE_TYPE
-
SSL_TRUST_STORE
public static final HtmlUnitOption SSL_TRUST_STORE
The SSL server certificate trust store. All server certificates will be validated against this trust store.NOTE: This option is omitted when serializing session settings. The SSL server certificate trust store type is serialized via SSL_TRUST_STORE_TYPE and the SSL server certificate trust store password is serialized via SSL_TRUST_STORE_PASSWORD
property: webdriver.htmlunit.sslTrustStore
type:KeyStore
default:null
see:SSL_TRUST_STORE_TYPE
see:SSL_TRUST_STORE_PASSWORD
-
SSL_TRUST_STORE_TYPE
public static final HtmlUnitOption SSL_TRUST_STORE_TYPE
Type of the specified SSL trust KeyStore (e.g. -jks
orpkcs12
).property: webdriver.htmlunit.sslTrustStoreType
type: char[]
default:null
see:SSL_TRUST_STORE
see:SSL_TRUST_STORE_PASSWORD
see:Security.getProviders
-
SSL_TRUST_STORE_PASSWORD
public static final HtmlUnitOption SSL_TRUST_STORE_PASSWORD
Password for the specified SSL trust KeyStore.property: webdriver.htmlunit.sslTrustStorePassword
type: char[]
default:null
see:SSL_TRUST_STORE
see:SSL_TRUST_STORE_TYPE
-
SSL_CLIENT_PROTOCOLS
public static final HtmlUnitOption SSL_CLIENT_PROTOCOLS
Sets the protocol versions enabled for use on SSL connections.property: webdriver.htmlunit.sslClientProtocols
type: String[]
default:null
(use default protocols)
see:SSLSocket.setEnabledProtocols
-
SSL_CLIENT_CIPHER_SUITES
public static final HtmlUnitOption SSL_CLIENT_CIPHER_SUITES
Sets the cipher suites enabled for use on SSL connections.property: webdriver.htmlunit.sslClientCipherSuites
type: String[]
default:null
(use default cipher suites)
see:SSLSocket.setEnabledCipherSuites
-
GEOLOCATION_ENABLED
public static final HtmlUnitOption GEOLOCATION_ENABLED
Enables/disables geo-location support.property: webdriver.htmlunit.geolocationEnabled
type:boolean
default:false
-
DO_NOT_TRACK_ENABLED
public static final HtmlUnitOption DO_NOT_TRACK_ENABLED
Enables/disables "Do Not Track" support.property: webdriver.htmlunit.doNotTrackEnabled
type:boolean
default:false
-
HOME_PAGE
public static final HtmlUnitOption HOME_PAGE
Sets the client's home page.property: webdriver.htmlunit.homePage
type:String
default: "https://www.htmlunit.org/"
-
PROXY_CONFIG
public static final HtmlUnitOption PROXY_CONFIG
Sets the proxy configuration for this client.property: webdriver.htmlunit.proxyConfig
type:ProxyConfig
default:null
-
TIMEOUT
public static final HtmlUnitOption TIMEOUT
Sets the timeout of theWebConnection
. Set to zero for an infinite wait.NOTE: The timeout is used twice. The first is for making the socket connection, the second is for data retrieval. If the time is critical you must allow for twice the time specified here.
property: webdriver.htmlunit.timeout
type:int
default: 90_000 (1.5 minutes in milliseconds)
-
CONNECTION_TIME_TO_LIVE
public static final HtmlUnitOption CONNECTION_TIME_TO_LIVE
Sets theconnTimeToLive
(in milliseconds) of theHttpClient
connection pool. Use this if you are working with web pages behind a DNS based load balancer.property: webdriver.htmlunit.connectionTimeToLive
type:long
default: -1 (use HTTP default)
-
USE_INSECURE_SSL
public static final HtmlUnitOption USE_INSECURE_SSL
If set totrue
, the client will accept connections to any host, regardless of whether they have valid certificates or not. This is especially useful when you are trying to connect to a server with expired or corrupt certificates.property: webdriver.htmlunit.useInsecureSSL
type:boolean
default:false
-
SSL_INSECURE_PROTOCOL
public static final HtmlUnitOption SSL_INSECURE_PROTOCOL
Sets the SSL protocol, used only whenUSE_INSECURE_SSL
is set totrue
.property: webdriver.htmlunit.sslInsecureProtocol
type:String
default:null
(use default protocol: SSL)
seeSSLContext
Algorithms
-
MAX_IN_MEMORY
public static final HtmlUnitOption MAX_IN_MEMORY
Sets the maximum bytes to have in memory, after which the content is saved to a temporary file.
NOTE: Set this to zero or -1 to deactivate the saving at all.property: webdriver.htmlunit.maxInMemory
type:int
default: 500 * 1024
-
HISTORY_SIZE_LIMIT
public static final HtmlUnitOption HISTORY_SIZE_LIMIT
Sets the maximum number ofpages
to cache in history. HtmlUnit usesSoftReference<Page>
for storing the pages that are part of the history. If you like to fine tune this you can useHISTORY_PAGE_CACHE_LIMIT
to limit the number of page references stored by the history.property: webdriver.htmlunit.historySizeLimit
type:int
default: 50
see:SoftReference
-
HISTORY_PAGE_CACHE_LIMIT
public static final HtmlUnitOption HISTORY_PAGE_CACHE_LIMIT
Sets the maximum number ofpages
to cache in history. If this value is smaller thanHISTORY_SIZE_LIMIT
, HtmlUnit will only use soft references for the first HISTORY_PAGE_CACHE_LIMIT entries in the history. For older entries, only the URL is saved; the page will be (re)retrieved on demand.property: webdriver.htmlunit.historyPageCacheLimit
type:int
default:Integer.MAX_VALUE
-
LOCAL_ADDRESS
public static final HtmlUnitOption LOCAL_ADDRESS
Sets the local address to be used for request execution.On machines with multiple network interfaces, this parameter can be used to select the network interface from which the connection originates.
property: webdriver.htmlunit.localAddress
type:InetAddress
default:null
(use default 'localhost')
-
DOWNLOAD_IMAGES
public static final HtmlUnitOption DOWNLOAD_IMAGES
Sets whether or not to automatically download images.property: webdriver.htmlunit.downloadImages
type:boolean
default:false
-
SCREEN_WIDTH
public static final HtmlUnitOption SCREEN_WIDTH
Sets the screen width.property: webdriver.htmlunit.screenWidth
type:int
default: 1920
-
SCREEN_HEIGHT
public static final HtmlUnitOption SCREEN_HEIGHT
Sets the screen height.property: webdriver.htmlunit.screenHeight
type:int
default: 1080
-
WEB_SOCKET_ENABLED
public static final HtmlUnitOption WEB_SOCKET_ENABLED
Enables/disables WebSocket support.property: webdriver.htmlunit.webSocketEnabled
type:boolean
default:true
-
WEB_SOCKET_MAX_TEXT_MESSAGE_SIZE
public static final HtmlUnitOption WEB_SOCKET_MAX_TEXT_MESSAGE_SIZE
Sets the WebSocketmaxTextMessageSize
.property: webdriver.htmlunit.webSocketMaxTextMessageSize
type:int
default: -1 {use default size)
-
WEB_SOCKET_MAX_TEXT_MESSAGE_BUFFER_SIZE
public static final HtmlUnitOption WEB_SOCKET_MAX_TEXT_MESSAGE_BUFFER_SIZE
Sets the WebSocketmaxTextMessageBufferSize
.property: webdriver.htmlunit.webSocketMaxTextMessageBufferSize
type:int
default: -1 {use default size)
-
WEB_SOCKET_MAX_BINARY_MESSAGE_SIZE
public static final HtmlUnitOption WEB_SOCKET_MAX_BINARY_MESSAGE_SIZE
Sets the WebSocketmaxBinaryMessageSize
.property: webdriver.htmlunit.webSocketMaxBinaryMessageSize
type:int
default: -1 {use default size)
-
WEB_SOCKET_MAX_BINARY_MESSAGE_BUFFER_SIZE
public static final HtmlUnitOption WEB_SOCKET_MAX_BINARY_MESSAGE_BUFFER_SIZE
Sets the WebSocketmaxBinaryMessageBufferSize
.property: webdriver.htmlunit.webSocketMaxBinaryMessageBufferSize
type:int
default: -1 {use default size)
-
FETCH_POLYFILL_ENABLED
public static final HtmlUnitOption FETCH_POLYFILL_ENABLED
Sets whether or not fetch polyfill should be used.property: webdriver.htmlunit.fetchPolyfillEnabled
type:boolean
default:false
-
FILE_PROTOCOL_FOR_XMLHTTPREQUESTS_ALLOWED
public static final HtmlUnitOption FILE_PROTOCOL_FOR_XMLHTTPREQUESTS_ALLOWED
Sets whether or not the file protocol is allowed for XMLHttpRequests.NOTE: If set to
true
, the client will accept XMLHttpRequests to URLs using the 'file' protocol. Allowing this introduces security problems and is therefore not allowed by current browsers. But some browsers have special settings to open this door; therefore, we have this option.property: webdriver.htmlunit.fileProtocolForXMLHttpRequestsAllowed
type:boolean
default:false
-
-
Method Detail
-
values
public static HtmlUnitOption[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (HtmlUnitOption c : HtmlUnitOption.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static HtmlUnitOption valueOf(String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException
- if this enum type has no constant with the specified nameNullPointerException
- if the argument is null
-
getCapabilityKey
public String getCapabilityKey()
- Specified by:
getCapabilityKey
in interfaceOptionEnum
-
getPropertyName
public String getPropertyName()
- Specified by:
getPropertyName
in interfaceOptionEnum
-
getOptionType
public Class<?> getOptionType()
- Specified by:
getOptionType
in interfaceOptionEnum
-
getDefaultValue
public Object getDefaultValue()
- Specified by:
getDefaultValue
in interfaceOptionEnum
-
isDefaultValue
public boolean isDefaultValue(Object value)
Determine if the specified value matches the default for this option.- Specified by:
isDefaultValue
in interfaceOptionEnum
- Parameters:
value
- value to be evaluated- Returns:
true
if specified value matches the default value; otherwisefalse
-
applyPropertyTo
public void applyPropertyTo(Map<String,Object> optionsMap)
- Specified by:
applyPropertyTo
in interfaceOptionEnum
-
encode
public Object encode(Object value)
Encode the specified value according to the type of this option.- Specified by:
encode
in interfaceOptionEnum
- Parameters:
value
- value to be encoded- Returns:
- option-specific encoding for specified value
-
decode
public Object decode(Object value)
Decode the specified value according to the type of this option.- Specified by:
decode
in interfaceOptionEnum
- Parameters:
value
- value to be decoded- Returns:
- option-specific decoding for specified value
-
insert
public void insert(WebClientOptions options, Object value)
Insert the specified value for this option into the provided web client options object.- Parameters:
options
-WebClientOptions
objectvalue
- value to be inserted
-
obtain
public Object obtain(WebClientOptions options)
Obtain the value for this option from the specified web client options object.- Parameters:
options
-WebClientOptions
object- Returns:
- value for this option
-
fromCapabilityKey
public static HtmlUnitOption fromCapabilityKey(String key)
Get the enumerated constant for the specified option key name.- Parameters:
key
- option key name- Returns:
HtmlUnitOption
constant for option key;null
if constant not found
-
fromPropertyName
public static HtmlUnitOption fromPropertyName(String name)
Get the enumerated constant for the specified system property name.- Parameters:
name
- system property name- Returns:
HtmlUnitOption
constant for property name;null
if constant not found
-
-