Skip to content
Related Articles
Open in App
Not now

Related Articles

How to Run Opera Driver in Selenium Using Java?

Improve Article
Save Article
  • Last Updated : 14 Oct, 2022
Improve Article
Save Article

Selenium is a well-known software used for software testing purposes. Selenium consists of three parts. One is Selenium IDE, one is Selenium Webdriver & the last one is Selenium Grid. Among these Selenium Webdriver is the most important one. Using Webdriver online website testing can be done. There are three main Webdrivers present. For the Chrome browser, ChromeDriver is present. For the Firefox browser, Gecko Driver is applicable. And for Microsoft Edge, there will be MSEdgeDriver present. Excluding these, many more drivers are present for other browsers. In this article, the process of running Opera Webdriver is implemented. It is useful for those who use Mac OS. This simple Java program can be run.


  • For running OperaDriver, the Java jdk version must be installed in the machine previously.
  • The latest version of Opera should be installed.
  • It is preferable to install Eclipse IDE on the machine so that running this code will be easier.
  • The most important prerequisite is latest OperaDriver should be downloaded on the machine.


  • Here, using OperaDriver, the login page of Facebook is going to open. For, that some methods need to be imported.
  • First, the Facebook login page link is to be stored in a string.
  • Then in the program, the property of the browser is to be set. setProperty() method is going to be used here.
  • In the setProperty() method, the first argument is to be the Webdriver that is to be going to use. Here, using OperaDriver specifically that argument have to be passed. And in the second argument, the location of OperaDriver.exe is to be passed.

Note: In this case, OperaDriver.exe is stored in Eclipse, so maybe the location seems different. But also, a complete File Explorer path can also be passed.

  • Then a new object called driver should be implemented which is a type of WebDriver. Here, in this case, it will be OperaDriver.
  • Then using that driver object, the get() method will be used. This get() method of WebDrivers helps to open some URLs provided.
  • Here the login page of Facebook is going to be opened. So, only the string where the URL has been stored will be passed. Executing this method will go to open a new Chrome window.
  • Then the sleep() method is going to be implemented. This delays the programs for some time. So that the output can be visible easily.
  • At last, the opened Opera window has to be closed. For that reason, the quit() method is going to be implemented.

Below is the complete implementation of the above approach:


// Importing All Necessary Items
import java.lang.Thread;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.opera.OperaDriver;
public class FacebookLoginPage {
    public static void main(String[] args)
        // Try-Catch Block For Implementing Sleep Method
        try {
            // String Where Home Page URL Is Stored
            String baseUrl = "";
            // Implementation of SetProperty Method
            System.setProperty("webdriver.opera.driver", "test/resources/operadriver.exe");
            // Creating New Object driver Of Webdriver
            WebDriver driver = new OperaDriver();
            // Calling the Home Page By Using Get() Method
            // Delaying The Output
            // Closing The Opened Window
        catch (Exception e) {
            // Catching The Exception


If the above code is run, then a new Opera Window will be opened. Hence, the process is completed successfully.



My Personal Notes arrow_drop_up
Related Articles

Start Your Coding Journey Now!