Pages

This package will contain all the page object classes that we'll be needing for our test case. You can read more about page objects here.

One important thing we need to take care is that all of our page classes should extend BasePage.java with webdriver instance as constructor argument. So the page factory is initialized. Which means The WebElement variables of our class are initialized with a proxy object by selenium.

Since all of our page classes extend BasePage it makes a very good place to initialize other required objects of selenium such as waits, actions etc., which require webdriver instance. So that we don't have to initialize them multiple times and all of these will be available in all sub classes.

We can also have some utility methods in BasePage such as double click, context click etc., so we don't have to rewrite the logic of these multiple times.

Last updated