Time for action – starting Opera - Selenium

In this section, we will see how we can start OperaDriver and get it to click a button on the page.This simple test will give us the confidence to use Selenium WebDriver with Opera.

  1. Update the setUp() method to load the OperaDriver() :
    driver = new OperaDriver();

  2. Now we need to find an element. In this section we will find the link Chapter 4:
    WebElement element = driver.findElement(By.linkText("Chapter 4"));

  3. Now we need to click on the link:

  4. Run your test and it should look like the following:

  5. What just happened?

    We have just seen how easy it is to get the OperaDriver loading Opera and interacting with what is on the page. We used click() on a link so that we can navigate between pages. Just by changing the object that is instantiated in the setUp() method we got it to load.

    Opera, like the previous browsers we have used, allows us to set details of the browser before the browser has started up. Let's have a look at how that works.


    The OperaProfile is a new addition to the OperaDriver. It allows us to set details in the browser when the browser starts. Opera Software tests the browser where it can, so we can set a lot of details of the browser. In the following example, we are going to disable Geolocation from our tests.

All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd DMCA.com Protection Status

Selenium Topics