Class ChromiumOptions<T extends ChromiumOptions<?>>

  • All Implemented Interfaces:
    java.io.Serializable, Capabilities
    Direct Known Subclasses:
    ChromeOptions, EdgeOptions

    public class ChromiumOptions<T extends ChromiumOptions<?>>
    extends AbstractDriverOptions<ChromiumOptions<?>>
    Class to manage options specific to ChromiumDriver.

    Example usage:

    
     ChromeOptions options = new ChromeOptions()
     options.addExtensions(new File("/path/to/extension.crx"))
     options.setBinary(new File("/path/to/chrome"));
    
     // For use with ChromeDriver:
     ChromeDriver driver = new ChromeDriver(options);
    
     // For use with RemoteWebDriver:
     RemoteWebDriver driver = new RemoteWebDriver(
         new URL("http://localhost:4444/"),
         new ChromeOptions());
     
    Since:
    Since chromedriver v17.0.963.0
    See Also:
    Serialized Form
    • Constructor Detail

      • ChromiumOptions

        public ChromiumOptions​(java.lang.String capabilityType,
                               java.lang.String browserType,
                               java.lang.String capability)
    • Method Detail

      • setBinary

        public T setBinary​(java.io.File path)
        Sets the path to the Chrome executable. This path should exist on the machine which will launch Chrome. The path should either be absolute or relative to the location of running ChromeDriver server.
        Parameters:
        path - Path to Chrome executable.
      • setBinary

        public T setBinary​(java.lang.String path)
        Sets the path to the Chrome executable. This path should exist on the machine which will launch Chrome. The path should either be absolute or relative to the location of running ChromeDriver server.
        Parameters:
        path - Path to Chrome executable.
      • addArguments

        public T addArguments​(java.lang.String... arguments)
        Parameters:
        arguments - The arguments to use when starting Chrome.
        See Also:
        addArguments(List)
      • addArguments

        public T addArguments​(java.util.List<java.lang.String> arguments)
        Adds additional command line arguments to be used when starting Chrome. For example:
        
           options.setArguments(
               "load-extension=/path/to/unpacked_extension",
               "allow-outdated-plugins");
         

        Each argument may contain an option "--" prefix: "--foo" or "foo". Arguments with an associated value should be delimited with an "=": "foo=bar".

        Parameters:
        arguments - The arguments to use when starting Chrome.
      • addExtensions

        public T addExtensions​(java.io.File... paths)
        Parameters:
        paths - Paths to the extensions to install.
        See Also:
        addExtensions(List)
      • addExtensions

        public T addExtensions​(java.util.List<java.io.File> paths)
        Adds a new Chrome extension to install on browser startup. Each path should specify a packed Chrome extension (CRX file).
        Parameters:
        paths - Paths to the extensions to install.
      • addEncodedExtensions

        public T addEncodedExtensions​(java.lang.String... encoded)
        Parameters:
        encoded - Base64 encoded data of the extensions to install.
        See Also:
        addEncodedExtensions(List)
      • addEncodedExtensions

        public T addEncodedExtensions​(java.util.List<java.lang.String> encoded)
        Adds a new Chrome extension to install on browser startup. Each string data should specify a Base64 encoded string of packed Chrome extension (CRX file).
        Parameters:
        encoded - Base64 encoded data of the extensions to install.
      • setExperimentalOption

        public T setExperimentalOption​(java.lang.String name,
                                       java.lang.Object value)
        Sets an experimental option. Useful for new ChromeDriver options not yet exposed through the ChromiumOptions API.
        Parameters:
        name - Name of the experimental option.
        value - Value of the experimental option, which must be convertible to JSON.
      • setHeadless

        public T setHeadless​(boolean headless)
      • setAndroidPackage

        public T setAndroidPackage​(java.lang.String androidPackage)
      • setAndroidActivity

        public T setAndroidActivity​(java.lang.String activity)
      • setAndroidDeviceSerialNumber

        public T setAndroidDeviceSerialNumber​(java.lang.String serial)
      • setUseRunningAndroidApp

        public T setUseRunningAndroidApp​(boolean useIt)
      • setAndroidProcess

        public T setAndroidProcess​(java.lang.String processName)
        Process name of the Activity hosting the WebView (as given by ps). If not set, the process name is assumed to be the same as androidPackage.
      • mergeInPlace

        protected void mergeInPlace​(Capabilities capabilities)