OperaDriver 0.9 was released two days ago. It contains quite a few changes and bug fixes, in particular some important API changes I wish to highlight. I'm also happy to introduce
OperaPreferences, two classes for managing an Opera profile and preferences (in both the profile and inside the browser) respectively.
Essentially many superfluous methods on the
OperaWebElement implementations have been removed to improve the consistency with the official
WebDriver interface. Don't panic, though: No functionality has been removed. Instead of using the removed/deprecated method calls there are smarter and better ways:
middleClick()has been left as-is for the time being, because the new API still lacks this.
getValue()has been replaced by
OperaProfile is a utility class for managing Opera profiles. It represents a profile (commonly a profile directory) and is typically used by passing in an instance object of this class to the "opera.profile" capability at construction of OperaDriver, like this:
DesiredCapabilities capabilities = DesiredCapabilities.opera(); OperaProfile profile = new OperaProfile(); profile.preferences().set("foo", "bar", "baz"); capabilities.setCapability("opera.profile", profile); WebDriver driver = new OperaDriver(capabilities);
If you call
OperaProfile's constructor without any arguments, it will produce a fresh random profile that will be populated by Opera once it's started. If you specify a file path or a string directory path, it will manipulate the profile specified.
OperaPreferences allows reading and interaction with preferences in the Opera. The old preferences API (
.getPref()) has been deprecated in favour of having the same API when interacting with preferences on the profile as well as in the browser.
It can be used like this when setting preferences on a profile:
OperaProfile profile = new OperaProfile(); // will create a random profile profile.preferences().set("User Prefs", "Ignore Unrequested Popups", false);
And it would work the same way if you wanted to retrieve a preference's value from the browser:
driver.preferences().get("User Prefs", "Ignore Unrequested Popups").getValue();
OperaLauncherRunner.isOperaRunning()no longer throws exception if launcher has shut down, but returns false instead.
SocketExceptions for double shutdown calls in
OperaDriver.close()now quits the browser if it closes the last window.
For the full list of changes, please see the attached change log.
The README can be found here: https://github.com/operasoftware/operadriver/blob/v0.9/README.md
OperaDriver 0.9 is available as a part of Selenium 2.17.
If using Maven, OperaDriver 0.9 is available in the group
com.opera under the artifact ID
You may download the OperaDriver JAR separately here: https://github.com/downloads/operasoftware/operadriver/operadriver-v0.9.zip
The generated API documentation has also been updated and can be found here: http://operasoftware.github.com/operadriver/docs/