Before You Begin
Open Chrome and go to https://trainingbypackt.github.io/Beginning-Selenium/lesson_6/activity_6_B-1.html.
Scenario
The Gigantic Store application home page contains three sections: a header, a navigation menu, and a banner that displays information, according to the option clicked by the user. We will model this home page by employing the nested Page Object approach, and we will write an automation script that makes use of the nested Page Objects.
Aim
To implement nested Page Object instances in a web application with different pages, such as a home page and a products page.
Steps for Completion
- Analyze the DOM and layout of the https://trainingbypackt.github.io/Beginning-Selenium/lesson_6/activity_6_B-1.html file.
- Create a Page Object for the Header section.
- Create a Page Object for the Menu section. Import packages such as WebDriver, By, and WebElement.
- Create a Page Object for the Banner section. Include methods to read the information on the banner, such as getMainInfo and getSecondaryInfo.
- Create a Page Object for HomePage.
- Create a Page Object for the Products page. Include methods to navigate the header and read the banner.
- Write an automation script that uses the Page Objects that were created. The script should include methods to verify the results in the products page and the home page.
- Compile and run the script.
To refer to the detailed steps, go to the Solutions section at the end of this book on Page no. 176.