Creating extensible page objects

So far, we have only looked at examples where a page object has been used to describe a whole page. Unfortunately, in the real world, web pages that we want to automate are usually much larger and more complicated than the examples that you find in a book. So, how are we going to deal with large, complicated pages while keeping the test code well-factored and readable? We are going to break things down into manageable chunks.

Let's have another look at the HTML page examples that we used earlier in this chapter. We will start with the index page.

If you look carefully, you will see that there are two parts that look particularly generic—the header (the area enclosed in the <nav> tag) and the footer (the area enclosed ...

Get Mastering Selenium WebDriver now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.