Building the right page factory is key which leads to less maintenance, well organized code and easy to understand the flow of the automated script and application.
now a days most of applications are web based and more complex in nature. it usually has lot of static and dynamic pages. while automating such applications, we have to make some systematic approach about how we should organize the code flow which will ultimately help in reducing maintenance efforts and easy to understand.
Page factory is one of concept to organized your code. selenium provide certain functionality to achieve it. many people have myth that page factory is test automation framework. but it is not a Test Automation Framework. you can use Page Factory in any Test Automation framework. it is just the way how you organized the code with functionality provided by Selenium API.
in this post , we will see how we can implement the Page factory in java and what is the best to organize the code.
The implementation of page factory will be same across all test automation framework. in this post we will see the Modular framework implementation with page factory.
if you look the modular framework without page factory, it will be like:
- Test classes
- Module wise classes which contains the business reusables
- Framework classes
- Utility classes
to implement the page factory in this framework, additionally we have create page factory classes.