Implementing nested Page Object instances

So far, we explored a very simple Page Object implementation for a single page web application. We can use the Page Object model to implement the objects of a page in a complex web application to simplify the testing.

In this recipe, we will create the objects of the Page Object model for the search functionality in an e-commerce application found at We can implement a Page Object model even if the specific functionality is not a page of its own.

Each page of the application provides the user with the ability to search for products on the site by entering a query and hitting the search button. When a search query is submitted, the application returns a new page with a list ...

Get Selenium Testing Tools Cookbook - Second Edition now with the O’Reilly learning platform.

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