Enum Class HtmlUnitOption

java.lang.Object
java.lang.Enum<HtmlUnitOption>
org.openqa.selenium.htmlunit.options.HtmlUnitOption
All Implemented Interfaces:
Serializable, Comparable<HtmlUnitOption>, Constable, HtmlUnitOptionNames, OptionEnum

public enum HtmlUnitOption extends Enum<HtmlUnitOption> implements HtmlUnitOptionNames, OptionEnum
Author:
Scott Babcock, Ronald Brill
  • Enum Constant Details

    • 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 associated onload/onerror events.

      property: webdriver.htmlunit.cssEnabled
      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

    • 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 it 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 or pkcs12).

      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 or pkcs12).

      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 the WebConnection. 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 the connTimeToLive (in milliseconds) of the HttpClient 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 to true, 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 when USE_INSECURE_SSL is set to true.

      property: webdriver.htmlunit.sslInsecureProtocol
      type: String
      default: null (use default protocol: SSL)
      see SSLContext 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 of pages to cache in history. HtmlUnit uses SoftReference<Page> for storing the pages that are part of the history. If you like to fine tune this you can use HISTORY_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 of pages to cache in history. If this value is smaller than HISTORY_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 WebSocket maxTextMessageSize.

      property: webdriver.htmlunit.webSocketMaxTextMessageSize
      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 WebSocket maxBinaryMessageSize.

      property: webdriver.htmlunit.webSocketMaxBinaryMessageSize
      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 Details

    • values

      public static HtmlUnitOption[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static HtmlUnitOption valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (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 class has no constant with the specified name
      NullPointerException - if the argument is null
    • getCapabilityKey

      public String getCapabilityKey()
      Description copied from interface: OptionEnum
      Returns the capability key associated with this option.
      Specified by:
      getCapabilityKey in interface OptionEnum
      Returns:
      the capability key
    • getPropertyName

      public String getPropertyName()
      Description copied from interface: OptionEnum
      Returns the property name for this option.
      Specified by:
      getPropertyName in interface OptionEnum
      Returns:
      the property name
    • getOptionType

      public Class<?> getOptionType()
      Description copied from interface: OptionEnum
      Returns the expected type of this option's value.
      Specified by:
      getOptionType in interface OptionEnum
      Returns:
      the option type
    • getDefaultValue

      public Object getDefaultValue()
      Description copied from interface: OptionEnum
      Returns the default value of this option.
      Specified by:
      getDefaultValue in interface OptionEnum
      Returns:
      the default value
    • isDefaultValue

      public boolean isDefaultValue(Object value)
      Determine if the specified value matches the default for this option.
      Specified by:
      isDefaultValue in interface OptionEnum
      Parameters:
      value - value to be evaluated
      Returns:
      true if specified value matches the default value; otherwise false
    • applyPropertyTo

      public void applyPropertyTo(Map<String,Object> optionsMap)
      Applies this option's value to the given options map.
      Specified by:
      applyPropertyTo in interface OptionEnum
      Parameters:
      optionsMap - the map of options to update
    • encode

      public Object encode(Object value)
      Encode the specified value according to the type of this option.
      Specified by:
      encode in interface OptionEnum
      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 interface OptionEnum
      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 object
      value - 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