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 you find in a book. So, how are we going to deal with large complicated pages while keeping our test code well factored and readable? We are going to break things down into manageable chunks.

Let's have another look at our HTML page examples 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 3.0 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.