Class BrowserConfigurationOptions


  • public class BrowserConfigurationOptions
    extends java.lang.Object
    Contains parameters for a single Selenium browser session. BrowserConfigurationOptions is used as an argument to Selenium.start(). The parameters set within will override any command-line parameters set for the same option.
    • Constructor Detail

      • BrowserConfigurationOptions

        public BrowserConfigurationOptions()
        Instantiate a blank BrowserConfigurationOptions instance.
    • Method Detail

      • hasOptions

        public boolean hasOptions()
        Returns true if any options are set in this instance.
        Returns:
        true if any options are set in this instance.
      • serialize

        public java.lang.String serialize()
        Serializes to the format "name=value;name=value".
        Returns:
        String with the above format.
      • setProfile

        public BrowserConfigurationOptions setProfile​(java.lang.String profile)
        Sets the name of the profile, which must exist in the -profilesLocation directory, to use for this browser session.
        Parameters:
        profile - the name of the profile.
        Returns:
        this BrowserConfigurationOptions object.
      • getProfile

        protected java.lang.String getProfile()
      • isSingleWindow

        protected boolean isSingleWindow()
        Returns true if the SINGLE_WINDOW field is set.
        Returns:
        true if SINGLE_WINDOW is set.
      • isMultiWindow

        protected boolean isMultiWindow()
        Returns true if the MULTI_WINDOW field is set.
        Returns:
        true if MULTI_WINDOW is set.
      • setSingleWindow

        public BrowserConfigurationOptions setSingleWindow()
        Sets SINGLE_WINDOW and unsets MULTI_WINDOW.
        Returns:
        this / self
      • getBrowserExecutablePath

        protected java.lang.String getBrowserExecutablePath()
      • setBrowserExecutablePath

        public BrowserConfigurationOptions setBrowserExecutablePath​(java.lang.String executablePath)
        Sets the full path for the browser executable.
        Parameters:
        executablePath - the full path for the browser executable.
        Returns:
        this / self
      • setTimeoutInSeconds

        public BrowserConfigurationOptions setTimeoutInSeconds​(int timeout)
        Sets the timeout, in seconds, for all commands.
        Parameters:
        timeout - the timeout for all commands
        Returns:
        this BrowserConfigurationOptions instance.
      • getTimeoutInSeconds

        protected int getTimeoutInSeconds()
      • setBrowserMode

        public BrowserConfigurationOptions setBrowserMode​(java.lang.String mode)
        Sets the "mode" for the browser. Historically, the 'browser' argument for getNewBrowserSession implied the mode for the browser. For example, *iehta indicated HTA mode for IE, whereas *iexplore indicated the default user mode. Using this method allows a browser mode to be specified independently of the base browser, eg. "HTA" or "PROXY". Note that absolutely no publication nor synchronization of these hard-coded strings such as "HTA" has yet been done. Use at your own risk until this is rectified.
        Parameters:
        mode - - examples "HTA" or "PROXY"
        Returns:
        this / self
      • getBrowserMode

        protected java.lang.String getBrowserMode()
      • getCommandLineFlags

        public java.lang.String getCommandLineFlags()
      • canUse

        protected boolean canUse​(java.lang.String value)
      • isSet

        public boolean isSet​(java.lang.String key)
      • get

        public java.lang.String get​(java.lang.String key)
      • set

        public BrowserConfigurationOptions set​(java.lang.String key,
                                               java.lang.String value)
        Sets the given key to the given value unless the value is null. In that case, no entry for the key is made.
        Parameters:
        key - the name of the key
        value - the value for the key
        Returns:
        this / self
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
        Returns:
        the serialization of this object, as defined by the serialize() method.