View Source

# module selenium-webdriver/opera

Defines a WebDriver client for the Opera web browser (v26+). Before using this module, you must download the latest OperaDriver release and ensure it can be found on your system PATH.

There are three primary classes exported by this module:

1. ServiceBuilder: configures the `remote.DriverService` that manages the OperaDriver child process.

2. Options: defines configuration options for each new Opera session, such as which proxy to use, what extensions to install, or what command-line switches to use when starting the browser.

3. Driver: the WebDriver client; each new instance will control a unique browser session with a clean user profile (unless otherwise configured through the `Options` class).

By default, every Opera session will use a single driver service, which is started the first time a `Driver` instance is created and terminated when this process exits. The default service will inherit its environment from the current process and direct all output to /dev/null. You may obtain a handle to this default service using `getDefaultService()` and change its configuration with `setDefaultService()`.

You may also create a `Driver` with its own driver service. This is useful if you need to capture the server's log output for a specific session:

    var opera = require('selenium-webdriver/opera');

    var service = new opera.ServiceBuilder()
        .loggingTo('/my/log/file.txt')
        .enableVerboseLogging()
        .build();

    var options = new opera.Options();
    // configure browser options ...

    var driver = new opera.Driver(options, service);

Users should only instantiate the `Driver` class directly when they need a custom driver service configuration (as shown above). For normal operation, users should start Opera using the `selenium-webdriver.Builder`.

## Functions

### getDefaultService()code »

Returns the default OperaDriver service. If such a service has not been configured, one will be constructed using the default configuration for a OperaDriver executable found on the system PATH.

Returns

`DriverService`

  The default OperaDriver service.

### setDefaultService(service)code »

Sets the default service to use for new OperaDriver instances.

Parameters

service`DriverService`

  The service to use.

Throws

`Error`

  If the default service is currently running.

## Types

Driver

  Creates a new WebDriver client for Opera.

Options

  Class for managing `OperaDriver` specific options.

ServiceBuilder

  Creates `remote.DriverService` instances that manages an OperaDriver server in a child process.