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...