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

Chapter 9. Understanding PageObject Pattern

Until now, we have seen various APIs of WebDriver and learned how to use them to accomplish various actions on the web application we're testing. We created many test scripts that use these APIs and are executed on a daily or weekly basis. One big challenge that you have to deal with, regarding these test scripts, is maintainability. In this chapter, we will cover the following topics:

  • What is the PageObject pattern design?

  • Good practices for designing PageObjects

  • Extensions to the PageObject pattern

  • An end-to-end example

A decently written test script would work just fine as long as the target web application doesn't change. But once one or more pages in your web application change, you as a test script writer shouldn't be in a position where you have to refactor your test scripts at a hundred different places. Let us see that with an example. We will try to go through this chapter by working on a WordPress blog. Before we start, I would like you to...