Saved searches
Use saved searches to filter your results more quickly
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session.
OperaDriver is a vendor-supported WebDriver implementation developed by Opera and volunteers that enables programmatic automation of different Opera products. It is a part of the Selenium project.
License
Rob—W/operadriver
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Sign In Required
Please sign in to use Codespaces.
Launching GitHub Desktop
If nothing happens, download GitHub Desktop and try again.
Launching GitHub Desktop
If nothing happens, download GitHub Desktop and try again.
Launching Xcode
If nothing happens, download Xcode and try again.
Launching Visual Studio Code
Your codespace will open once ready.
There was a problem preparing your codespace, please try again.
Latest commit
Git stats
Files
Failed to load latest commit information.
README.md
OperaDriver is a vendor-supported WebDriver implementation developed by Opera and volunteers that enable programmatic automation of different Presto-based Opera products. It is a part of the Selenium project.
WebDriver is a general purpose library for automating web browsers. It can drive the browser running various tests on your web pages, just as if a real user was navigating through them. It can emulate actions like clicking links, enter text and submitting forms, and reporting results back to you so you know that your website works as intended.
OperaDriver’s end-user emulation ensures that your entire stack (HTML, scripts, styling, embedded resources and backend setup) is functioning correctly without tedious manual testing routines.
OperaDriver is usable out of the box from the official Selenium packages, and can be used no extra setup on any modern version of Opera.
To get set up, first download either the selenium-server-standalone or selenium-server package and make sure you have a fairly recent version of Opera installed in a default location. Finally, all you need to do is create a new OperaDriver instance:
WebDriver driver = new OperaDriver(); driver.get("http://opera.com/");
If you prefer using a package management system, OperaDriver is also available through Maven; either as a part of the Selenium package, or as a separate package. The group ID for Selenium is org.openqa.selenium.* , and com.opera and artifact ID operadriver for OperaDriver specifically.
Since WebDriver provides bindings for several programming languages, you can follow the same approach as above in both Python (using the selenium package) and in Ruby (using the selenium-webdriver gem).
The Python equivalent of the above example would be:
from selenium import webdriver driver = webdriver.Opera() driver.get('http://opera.com/')
require 'selenium-webdriver' driver = Selenium::WebDriver.for :opera driver.get('http://opera.com/')
To execute the tests, please ensure that the environmental variable SELENIUM_SERVER_JAR contains the path to the selenium-server-standalone JAR you downloaded earlier.
To execute the Python test:
SELENIUM_SERVER_JAR=/path/to/selenium-server-standalone.jar python test.py
SELENIUM_SERVER_JAR=/path/to/selenium-server-standalone.jar ruby test.rb
Running the server as a standalone process
OperaDriver is fully compatible with the RemoteWebDriver client. This allows you to run tests on a remote computer which is typically very useful in a distributed environment. First, ensure that your Selenium server is running, then create a remote client as usual:
WebDriver driver = new RemoteWebDriver("http://localhost:4444", DesiredCapabilities.opera()); driver.get("http://opera.com/");
To customize Opera and WebDriver in various ways you may request a certain configuration from the Selenium server. Since not all server implementations supports every WebDriver feature, the client and server should use JSON objects with the properties when describing which features are desirable.
In additon to the general WebDriver capabilities available, OperaDriver has a number of custom capabilities that may be requested. To request a specific driver configuration you
You can use the DesiredCapabilities class to request a specific driver configuration. The Opera-specific capabilities supported are:
OperaDriver also supports some of the common desired capabilities too:
For instance the OperaDriver can be made to start the browser with specific command-line arguments using the opera.arguments key. This key should define a list of a command-line arguments that should be passed to the browser on startup. For example, to start Opera with a custom profile:
DesiredCapabilities capabilities = DesiredCapabilities.opera(); OperaProfile profile = new OperaProfile("/path/to/profile"); // prepared profile capabilities.setCapability("opera.profile", profile); WebDriver driver = new OperaDriver(capabilities);
Or to tell the Opera Mobile Emulator to use the tablet UI and a specific screen resolution:
DesiredCapabilities capabilities = DesiredCapabilities.opera(); capabilities.setCapability("opera.product", OperaProduct.MOBILE); capabilities.setCapability("opera.arguments", "-tabletui -displaysize 860x600"); WebDriver driver = new OperaDriver(capabilities);
An emulation profile may be specified when interacting with Opera Mobile to instruct the emulator to use a certain configuration. You may either give it an instance of OperaMobileEmulation which transparently deserializes into a JSON object, or a JSON object directly:
Similarly, to increase the logging verbosity and, for GNU/Linux, ask Opera to start on a different X display:
DesiredCapabilities capabilities = DesiredCapabilities.opera(); capabilities.setCapability("opera.logging.level", Level.CONFIG); capabilities.setCapability("opera.logging.file", "/var/log/operadriver.log"); capabilities.setCapability("opera.display", 8); WebDriver driver = new OperaDriver(capabilities);
It is also possible to configure a proxy for use with Opera. The proxy configuration is set through the capabilities. You can use the Proxy helper in Selenium to manage it:
DesiredCapabilities capabilities = DesiredCapabilities.opera(); Proxy proxy = new Proxy(); proxy.setHttpProxy("127.0.0.1:1234"); capabilities.setCapability("proxy", proxy); WebDriver driver = new OperaDriver(capabilities);
To specify a custom location of the Opera binary and the command-line arguments to use, you may also use environmental variables. These are the available variables:
Name | Description |
---|---|
OPERA_PATH | The absolute path to the Opera binary you want to use. If not set OperaDriver will try to locate an Opera (desktop or mobile) on your system. |
OPERA_ARGS | A space-delimited list of arguments to pass on to Opera, e.g. -nowindow , -dimensions 1600×1200 , &c. See opera -help or operamobile -help to see available arguments. |
To set environment variables:
- GNU/Linux and Mac: export OPERA_PATH=. , and add this line to ~/.bashrc (or your shell’s configuration file) to use in all future sessions.
- Windows: Please follow this guide: http://support.microsoft.com/kb/310519
This is a list of the official Opera Desktop versions supported by OperaDriver. Please note that this Java version of OperaDriver will not support future Chromium-based Operas.
Version | Workaround/tweaks needed |
---|---|
12.15 | |
12.14 | |
12.13 | |
12.12 | |
12.10 | |
12.01 | |
12.00 | |
11.64 | |
11.62 | |
11.61 | |
11.60 | |
11.52 | Set opera.port to -1 and opera.profile to «» (empty string) to disable -debugproxy and -pd command-line arguments |
11.51 | |
11.50 | |
11.11 | |
11.10 | |
11.01 | -autotestmode command-line argument is not supported, use a wrapper script |
11.00 |
Please use one of the prepared builds to use OperaDriver with Opera Mobile.
OperaDriver does not support the Chromium-based Opera Mobile builds.
Some Opera versions don’t support the -autotestmode , -debugproxy or -pd arguments sent by OperaDriver by default. You can bypass this problem by creating a wrapper script like this and pointing the capability opera.binary to its absolute path:
#!/bin/sh # Wrapper to prevent the -autotestmode argument reaching this version of Opera # which doesn't support it. `dirname $0`/opera
While OperaDriver is officially maintained by Opera, it is free software and would only be possible thanks to many volunteer contributors. If you come across a reproducible bug, please open an issue to submit a bug report.
Even better, you can send a pull request! Any changes you make must follow the Google Coding Standards and have test cases attached to them if you introduce a new feature.
Much of OperaDriver’s code is shared with the other WebDriver implementations, and for working on this code base you should also familiarize yourself with the Selenium code base. There are also a few tips available for working on Selenium.
If you have problems or questions regarding OperaDriver or Selenium, there are many channels in which you can seek help:
- IRC: The #selenium channel on the irc.freenode.org network
- Mailing lists: The webdriver or selenium-users mailing list
About
OperaDriver is a vendor-supported WebDriver implementation developed by Opera and volunteers that enables programmatic automation of different Opera products. It is a part of the Selenium project.