Using the LoadableComponent class

We can implement the objects of the Page Object model using the LoadableComponent class of Selenium WebDriver. This helps in building a robust Page Object that provides a standard way to ensure that the page is loaded and that the page load issues are easy to debug.

In this recipe, we will further refactor the BmiCalcPage class created in the previous recipes and extend it as a loadable component.

Getting ready

This recipe uses the BmiCalcPage class created in the previous recipe.

How to do it...

To implement an object of the Page Object model as the LoadableComponent class, we need to extend it from the LoadableComponent base class, as shown in the following example:

package com.secookbook.examples.chapter08.pageobjects; ...

Get Selenium Testing Tools Cookbook - Second Edition 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.