Activity: Implementing Nested Page Object Instances

  1. Analyze the DOM and layout of the https://trainingbypackt.github.io/Beginning-Selenium/lesson_6/activity_6_B-1.html file.
  2. Create a Page Object for the Header section:
package com.beginningselenium.examples.pageobjects;import org.openqa.selenium.WebDriver;import org.openqa.selenium.chrome.ChromeDriver;import org.openqa.selenium.WebElement;public class HeaderPage {     //WebElements     private WebElement home;         ///WebDriver         private WebDriver driver;     //Class Constructor    public HeaderPage(WebDriver driver) {         this.driver = driver; }         // Methods to navigate the header     public HomePage goToHome(){ home = driver.findElement(By.id("home"));     home.click();     return new HomePage();     } }
  1. Create a Page ...

Get Selenium Fundamentals now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.