O'Reilly logo

Selenium Fundamentals by Diego Molina

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required