Enum HtmlUnitOption

    • 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 associated onload/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 to true, the window.open() function has no effect and returns null.

        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_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_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

      • 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_TEXT_MESSAGE_BUFFER_SIZE

        public static final HtmlUnitOption WEB_SOCKET_MAX_TEXT_MESSAGE_BUFFER_SIZE
        Sets the WebSocket maxTextMessageBufferSize.

        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 WebSocket maxBinaryMessageSize.

        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 WebSocket maxBinaryMessageBufferSize.

        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 name
        NullPointerException - if the argument is null
      • 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
      • 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