Class OperaOptions

  • All Implemented Interfaces:
    java.io.Serializable, Capabilities

    public class OperaOptions
    extends AbstractDriverOptions<OperaOptions>
    Class to manage options specific to OperaDriver.

    Example usage:

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

      • OperaOptions

        public OperaOptions()
    • Method Detail

      • setBinary

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

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

        public OperaOptions addArguments​(java.util.List<java.lang.String> arguments)
        Adds additional command line arguments to be used when starting Opera. 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 Opera.
      • addExtensions

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

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

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

        public java.lang.Object getExperimentalOption​(java.lang.String name)
        Returns the value of an experimental option.
        Parameters:
        name - The option name.
        Returns:
        The option value, or null if not set.