Enum Class BrowserVersionTrait

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

public enum BrowserVersionTrait extends Enum<BrowserVersionTrait> implements BrowserVersionTraitNames, OptionEnum
Defines traits of a BrowserVersion that can be configured or queried. Implements BrowserVersionTraitNames for standardized trait names and OptionEnum for capability and property management.
Author:
Scott Babcock, Ronald Brill
  • Enum Constant Details

    • NUMERIC_CODE

      public static final BrowserVersionTrait NUMERIC_CODE
      Returns the numeric code for the browser represented by this BrowserVersion.

      property: webdriver.htmlunit.numericCode
      type: int
      default: 0

    • NICKNAME

      public static final BrowserVersionTrait NICKNAME
      Returns the nickname for the browser represented by this BrowserVersion.

      property: webdriver.htmlunit.nickname
      type: String
      default: null

    • APPLICATION_VERSION

      public static final BrowserVersionTrait APPLICATION_VERSION
      Returns the application version, for example "4.0 (compatible; MSIE 6.0b; Windows 98)".

      property: webdriver.htmlunit.applicationVersion
      type: String
      default: null
      see: MSDN documentation

    • USER_AGENT

      public static final BrowserVersionTrait USER_AGENT
      Returns the user agent string, for example "Mozilla/4.0 (compatible; MSIE 6.0b; Windows 98)".

      property: webdriver.htmlunit.userAgent
      type: String
      default: null

    • APPLICATION_NAME

      public static final BrowserVersionTrait APPLICATION_NAME
      Returns the application name, for example "Microsoft Internet Explorer".

      property: webdriver.htmlunit.applicationName
      type: String
      default: null

      See Also:
    • APPLICATION_CODE_NAME

      public static final BrowserVersionTrait APPLICATION_CODE_NAME
      Returns the application code name, for example "Mozilla".

      property: webdriver.htmlunit.applicationCodeName
      type: String
      default: "Mozilla"
      see: MSDN documentation

    • APPLICATION_MINOR_VERSION

      public static final BrowserVersionTrait APPLICATION_MINOR_VERSION
      Returns the application minor version, for example "0".

      property: webdriver.htmlunit.applicationMinorVersion
      type: String
      default: "0"
      see: MSDN documentation

    • VENDOR

      public static final BrowserVersionTrait VENDOR
      Returns the browser vendor, for example "Google Inc.".

      property: webdriver.htmlunit.vendor
      type: String
      default: ""

    • BROWSER_LANGUAGE

      public static final BrowserVersionTrait BROWSER_LANGUAGE
      Returns the browser language, for example "en-US".

      property: webdriver.htmlunit.browserLanguage
      type: String
      default: "en_US"

    • IS_ONLINE

      public static final BrowserVersionTrait IS_ONLINE
      Returns true if the browser is currently online.

      property: webdriver.htmlunit.isOnline
      type: boolean
      default: true
      see: MSDN documentation

    • PLATFORM

      public static final BrowserVersionTrait PLATFORM
      Returns the platform on which the application is running, for example "Win32".

      property: webdriver.htmlunit.platform
      type: String
      default: "Win32"
      see: MSDN documentation

    • SYSTEM_TIMEZONE

      public static final BrowserVersionTrait SYSTEM_TIMEZONE
      Returns the system TimeZone.

      property: webdriver.htmlunit.systemTimezone
      type: TimeZone
      default: TimeZone.getTimeZone("America/New_York")

    • ACCEPT_ENCODING_HEADER

      public static final BrowserVersionTrait ACCEPT_ENCODING_HEADER
      Returns the value used by the browser for the Accept-Encoding header.

      property: webdriver.htmlunit.acceptEncodingHeader
      type: String
      default: null

    • ACCEPT_LANGUAGE_HEADER

      public static final BrowserVersionTrait ACCEPT_LANGUAGE_HEADER
      Returns the value used by the browser for the Accept-Language header.

      property: webdriver.htmlunit.acceptLanguageHeader
      type: String
      default: null

    • HTML_ACCEPT_HEADER

      public static final BrowserVersionTrait HTML_ACCEPT_HEADER
      Returns the value used by the browser for the Accept header if requesting a page.

      property: webdriver.htmlunit.htmlAcceptHeader
      type: String
      default: null

    • IMG_ACCEPT_HEADER

      public static final BrowserVersionTrait IMG_ACCEPT_HEADER
      Returns the value used by the browser for the Accept header if requesting an image.

      property: webdriver.htmlunit.imgAcceptHeader
      type: String
      default: null

    • CSS_ACCEPT_HEADER

      public static final BrowserVersionTrait CSS_ACCEPT_HEADER
      Returns the value used by the browser for the Accept header if requesting a CSS declaration.

      property: webdriver.htmlunit.cssAcceptHeader
      type: String
      default: null

    • SCRIPT_ACCEPT_HEADER

      public static final BrowserVersionTrait SCRIPT_ACCEPT_HEADER
      Returns the value used by the browser for the Accept header if requesting a script.

      property: webdriver.htmlunit.scriptAcceptHeader
      type: String
      default: null

    • XML_HTTP_REQUEST_ACCEPT_HEADER

      public static final BrowserVersionTrait XML_HTTP_REQUEST_ACCEPT_HEADER
      Returns the value used by the browser for the Accept header if performing an XMLHttpRequest.

      property: webdriver.htmlunit.xmlHttpRequestAcceptHeader
      type: String
      default: null

    • SEC_CLIENT_HINT_USER_AGENT_HEADER

      public static final BrowserVersionTrait SEC_CLIENT_HINT_USER_AGENT_HEADER
      Returns the value used by the browser for the Sec-CH-UA header.

      property: webdriver.htmlunit.secClientHintUserAgentHeader
      type: String
      default: null

    • SEC_CLIENT_HINT_USER_AGENT_PLATFORM_HEADER

      public static final BrowserVersionTrait SEC_CLIENT_HINT_USER_AGENT_PLATFORM_HEADER
      Returns the value used by the browser for the Sec-CH-UA-Platform header.

      property: webdriver.htmlunit.secClientHintUserAgentPlatformHeader
      type: String
      default: null

  • Method Details

    • values

      public static BrowserVersionTrait[] 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 BrowserVersionTrait 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 trait.
      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)
      Apply the value of the system property associated with this trait to the specified options map.
      Specified by:
      applyPropertyTo in interface OptionEnum
      Parameters:
      optionsMap - browser version options map
    • encode

      public Object encode(Object value)
      Encode the specified value according to the type of this trait.
      Specified by:
      encode in interface OptionEnum
      Parameters:
      value - value to be encoded
      Returns:
      trait-specific encoding for specified value
    • decode

      public Object decode(Object value)
      Decode the specified value according to the type of this trait.
      Specified by:
      decode in interface OptionEnum
      Parameters:
      value - value to be decoded
      Returns:
      trait-specific decoding for specified value
    • apply

      public void apply(Object value, BrowserVersion.BrowserVersionBuilder builder)
      Apply the specified value for this trait into the provided browser version builder.
      Parameters:
      value - value to be inserted
      builder - BrowserVersion.BrowserVersionBuilder object
    • obtain

      public Object obtain(BrowserVersion version)
      Obtain the value for this trait from the specified browser version object.
      Parameters:
      version - BrowserVersion object
      Returns:
      value for this trait
    • fromCapabilityKey

      public static BrowserVersionTrait fromCapabilityKey(String key)
      Returns the BrowserVersionTrait corresponding to the given capability key.
      Parameters:
      key - the capability key to look up
      Returns:
      the matching BrowserVersionTrait, or null if none matches
    • fromPropertyName

      public static BrowserVersionTrait fromPropertyName(String name)
      Returns the BrowserVersionTrait corresponding to the given property name.
      Parameters:
      name - the property name to look up
      Returns:
      the matching BrowserVersionTrait, or null if none matches