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

Chapter 5. Design Patterns

A design pattern is a general reusable solution to a commonly occurring problem within a given context in software design. In this chapter, we will take a look at good design patterns to create maintainable and reusable bits of code that we can use with our Selenium tests. This means that, if there are any changes needed to our web application, or any changes in the way we need to find elements, we can change them once and have things fixed very quickly.

In this chapter, we will learn the following topics:

  • Using Page Object design

  • Using the PageFactory Selenium library in Page objects

  • Using the LoadableComponents Selenium library

In this chapter, it is assumed that all files will have the following import statements:

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;

So let's get on with it.