Capabilities in OperaDriver

We recently added Capabilities support for OperaDriver. This will allow you to use the OperaDriver implementation with Remote WebDriver, the client that allows you to hook up to a “hub” or “server” managing your actual browser instance.

It also enables you to use other language bindings, such as Ruby and Python, with Opera. Since OperaDriver is written natively in Java, we don't replicate any of the code logic in other languages, but instead forward the command calls directly to the Java implementation.

Jari Bakken has written an outstanding gem called selenium-webdriver which works great with OperaDriver. I'm working on adding proper support for Python and Perl.

From Java however, it's quite easy to use:


DesiredCapabilities capabilities = new DesiredCapabilities.opera();
capabilities.setCapability("opera.binary", "/path/to/your/opera");
capabilities.setCapability("opera.log.level", "CONFIG");
WebDriver driver = new OperaDriver(capabilities);

The available settings are:

opera.logging.level
(String) How verbose the logging should be. Available levels are: SEVERE (highest value), WARNING, INFO, CONFIG, FINE, FINER, FINEST (lowest value), ALL. Default is INFO.
opera.logging.file
(String) Where to send the output of the logging. Default is to not write to file.
opera.binary
(String) Path to the Opera binary to use. If not specified, OperaDriver will guess the path to your Opera installation (typically /usr/bin/opera or C:\Program Files\Opera\opera.exe).
opera.host
(String) The host Opera should connect to. Unless you're starting Opera manually you won't need this.
opera.port
(Integer) The port to Opera should connect to. 0 = Random, -1 = Opera default (for use with Opera > 12).
opera.launcher
(String) Path to the launcher binary to use. The launcher is a gateway between OperaDriver and the Opera browser, and is being used for controlling the binary and taking external screenshots. If left blank, OperaDriver will use the launcher supplied with the package.
opera.arguments
(String) Arguments to pass to Opera, separated by spaces. See opera -help for available command-line switches.
opera.profile
(String) Directory to use for the Opera profile. If null a random temporary directory is used. If "", an empty string, then the default autotest profile directory is used.
opera.idle
(Boolean) Whether to use Opera's alternative implicit wait implementation. It will use an in-browser heuristic to guess when a page has finished loading, allowing us with great accuracy tell whether there are any planned events in the document. This functionality is useful for very simple test cases, but not designed for real-world testing. It is disabled by default.
opera.display
(Integer) The X display to use. (Only works on UNIX-like OSes.)
opera.autostart
(Boolean) Whether to auto-start the Opera binary. If false, OperaDriver will wait for a connection from the browser. Go to "opera:debug", enter the correct port number, and hit "Connect" to connect manually.
opera.no_restart
(Boolean) Whether to restart.
opera.no_quit
(Boolean) Whether to quit Opera when OperaDriver is shut down. If enabled, it will keep the browser running after the driver is shut down.
opera.guess_binary_path
(Boolean) Whether to guess the path to Opera if it isn't set in opera.binary.
opera.binary_profile
(String) The profile configuration we are using, for example "desktop" or "core-gogi".

Note that the Capabilities object completely replace the old OperaDriverSettings object, which has now been deprecated. We will keep the support for OperaDriverSettings in until v0.7.4 or v0.8.