Book Image

Learning Selenium Testing Tools - Third Edition

Book Image

Learning Selenium Testing Tools - Third Edition

Overview of this book

Table of Contents (22 chapters)
Learning Selenium Testing Tools Third Edition
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Working with OperaDriver


Opera Software, the company that created Opera, has built their own project to support Selenium WebDriver. Since not every web browser will act the same with the sites that we create, it is a good idea to make sure we can test our applications with OperaDriver.

Note

Note that OperaDriver works best with the latest stable release of Opera. Make sure that you update it regularly.

Let's see how easy OperaDriver is to use. 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 OperaDriver():

    driver = new OperaDriver();
  2. Now we will 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 will need to click on the link:

    element.click();
  4. Run your test and it should look like the following:

    import org.openqa.selenium.*;
    import org...