LoadableComponent - Selenium

LoadableComponent is another way to approach PageObjects. LoadableComponent is a base class that all of the pages need to extend. The base class has the following methods on the interface:

  • get()

  • isLoaded()

  • load()

Instead of the usual public class PageObject, we change it:

public class PageObject extends LoadableComponent<PageObject>

We will have to add overrides for the load() and isLoaded() method. The load method will load the page for us and the isLoaded() method can allow us to check if the page has been loaded correctly. 

For example:

As we can see this is just a simple bit of code, but we can make sure that we start on the right page when we need to.

All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd DMCA.com Protection Status

Selenium Topics