Book Image

Selenium WebDriver Practical Guide

By : Satya Avasarala
Book Image

Selenium WebDriver Practical Guide

By: Satya Avasarala

Overview of this book

<p>Selenium WebDriver is an open source web UI automation tool implemented through a browser-specific browser driver, which sends commands to a browser and retrieves results.<br /><br />Selenium WebDriver Practical Guide will guide you through the various APIs of WebDriver which should be used in automation tests, followed by a discussion of the various WebDriver implementations available. This guide will support you by offering you access to source code fi les, including the essential HTML&nbsp; fi les, that allow you to work with jQuery and other examples throughout the book. Finally, you will receive an in-depth explanation of how to deal with the latest features of WebDriver through step-by-step practical tutorials.</p>
Table of Contents (17 chapters)
Selenium WebDriver Practical Guide
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Working on an end-to-end example of WordPress


Now that we have understood what PageObjects are, it is time to take a look at an end-to-end example that interacts and tests the WordPress Admin console. First, we will see all the PageObjects and then the test cases that use them.

Looking at all the PageObjects

Let us first see all the PageObjects that are involved in testing the WordPress Admin console.

The AdminLoginPage PageObject

The AdminLoginPage PageObject deals with the login page. This object has to be refactored if any changes have been made to the page in the target application, using the following code:

package com.packt.webdriver.chapter9.pageObjects;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.CacheLookup;
import org.openqa.selenium.support.FindBy;
import org.openqa.selenium.support.How;
import org.openqa.selenium.support.PageFactory;
public class AdminLoginPage {
    WebDriver driver;
    @FindBy(how=How.ID, using...