O'Reilly logo

Selenium Testing Tools Cookbook by Unmesh Gundecha

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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

For implementing an object of the Page Object model as the LoadableComponent class, we need to extend it from the LoadableComponent base class by performing the following steps:

  1. Add an import statement for org.openqa.selenium.support.ui.LoadableComponent ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required