The design pattern known as Page Object Model (POM), which is frequently used in test automation, creates an object repository for web UI elements. The model's benefit is that it minimises code duplication and enhances test maintenance.
Consider each web page of an application as a class file in the Page Object Model. Only the web page elements that relate to each class file will be present. Testers can do out actions on the website they are testing using these components.
All of the Web Elements of the AUT(Application under test) and the methods that operate on them are contained inside of a class file, which is the fundamental structure of the Page Object Model Framework. Verification should not be grouped with other Test methodology tasks.
Here are we are dealing with 2 pages
1. Google Page
2. Login Page
Accordingly, we create 2 POM in Selenium classes
Run the test case as “TestNg Test”
Note: If you cannot see testNG Test go to build path in libraries add library. In that select testNG and apply.
Selenium web driver is used for automating the web-application, but It won’t generate any reports by default so we need to use testng/cucumber for report.
• The TestNG will generate the default report.
• When you execute testng.xml file, and refresh the project. You will get test-output folder in that folder for reporting in TestNG.
• Right click on the emailable-report.html and select the option. Open with the web browser.
Method-1: emailable-report.html
Method-2: index.html
The Page Object Model-Design Pattern helps us to optimise our code, reduce code duplication, and maintain test cases more effectively. By employing this pattern, we may improve the readability of our code and the effectiveness of code maintenance.
Our brand name and motto embody our unwavering commitment to delivering services with agility, quality, and efficiency, ensuring that our clients and international business partners receive unmatched excellence.
meteoriQs Towers,
1B, Ground Floor Business Center,
SheshadhriNagar,
Nedungundram,
New Perungalathur,
Chennai-127, India