#1 India's Top IT Training Institute

On Demand Courses

9 programs

×

About Uncodemy

Know more about who we are and what we stand for.

About Us

About Us

Discover our mission to equip individuals with essential IT skills and industry expertise.

Read More →
UnCodeMy Gallery

UnCodeMy Gallery

Explore highlights from our IT training sessions and success stories.

Read More →
×

Free Resources

Learn, practice and plan your career — bilkul free.

Tutorials

Tutorials

Step-by-step written tutorials to learn any technology at your own pace.

Read More →
Free Counselling

Free Counselling

Book a free video counselling session and pick the right course for you.

Read More →
Online Compiler

Online Compiler

Write, run and test your code online — no setup required.

Read More →

Selenium Page Object Model Guide
PDF Downloads

Download the Selenium Page Object Model guide PDF from Uncodemy: structure, base page, locators and a worked Java login example.

Prepared by: Uncodemy trainer team Reviewed by: Uncodemy Last reviewed: 26 Oct 2026
POM at a Glance
1
One class per pageEach page or component gets its own class.
2
Locators + actionsThe class stores locators and exposes user-intent methods.
3
Tests call methodsTests contain assertions and flow — no locators.
4
Base pageShared driver handling, explicit waits and helpers.
5
Return next pageMethods return the next page object when navigation happens.
6
Stable locatorsIDs and data-test attributes over long XPath chains.

Quick Answer

This page offers Uncodemy's Selenium Page Object Model guide as a PDF download. The Page Object Model is a design pattern in which each page or component of the application is represented by a class that holds its locators and actions. The guide shows the structure, a worked Java example and the benefits and pitfalls.

Download

Selenium POM PDFs

Three quick-access entry points into the same Selenium POM guide PDF: the full guide, the base page + login example pack, and the design rules + locator strategy reference. All PDFs on this page are free to download. No form is required.

3 PDFs Available
PDF 01 Main Guide

Page Object Model Guide

The complete guide to Selenium POM — what it is, without-vs-with-POM comparison, project layers, base page, login example, PageFactory, design rules and pitfalls.

[N] pages [X] MB Oct 2026
Download PDF
PDF 02 Code Example

Base Page & Login Example Pack

A worked Java example using Selenium 4: a shared BasePage with explicit-wait helper, a LoginPage object, and a test that verifies a successful login returns the next page object.

[N] pages [X] MB Oct 2026
Download PDF
PDF 03 Design & Locators

Design Rules & Locator Strategy Pack

Design rules for good page objects, the locator-strategy stability comparison table, common component objects, common mistakes, and a step-by-step refactoring guide.

[N] pages [X] MB Oct 2026
Download PDF

All three download buttons open the same Selenium POM guide PDF file. By downloading, you agree to our Privacy Policy. These PDFs are study material only — not a certificate or job guarantee.

00

What is the Page Object Model?

The Page Object Model, or POM, is a design pattern for UI test automation. Each page of the application, or each significant component such as a header or a modal, gets a class. The class stores the locators of the elements on that page and exposes methods that describe what a user can do there, such as login or searchFor. Tests then call these methods and contain assertions and flow, but no locators. The result is that when the interface changes, you update one page class instead of dozens of tests, and tests read like descriptions of user behaviour. Without POM, locators are copied through many tests and maintenance becomes the main cost of automation.

01

Without POM versus with POM

Aspect Without POM With POM
Locators Repeated in many tests Defined once in the page class
Maintenance Many files change when the UI changes One page class changes
Readability Low-level driver calls in tests Tests read as user actions
Reuse Copy and paste Methods reused across tests
Separation Mixed locators, actions and checks Clear layers
02

Typical project layers

Layer Responsibility
Base page or base test Shared driver handling, waits and helpers
Page classes Locators and user actions of one page
Test classes Scenarios and assertions
Utilities Configuration, data readers, screenshots
Test data and resources Files and environment settings
03

A base page with an explicit wait helper

A small shared parent class for page objects. Illustrative Java using Selenium 4.

import java.time.Duration;
import org.openqa.selenium.*;
import org.openqa.selenium.support.ui.*;

public abstract class BasePage {
    protected final WebDriver driver;
    private final WebDriverWait wait;

    protected BasePage(WebDriver driver) {
        this.driver = driver;
        this.wait = new WebDriverWait(driver, Duration.ofSeconds(10));
    }

    protected WebElement visible(By locator) {
        return wait.until(ExpectedConditions.visibilityOfElementLocated(locator));
    }

    protected void type(By locator, String text) {
        WebElement el = visible(locator);
        el.clear();
        el.sendKeys(text);
    }

    protected void click(By locator) {
        wait.until(ExpectedConditions.elementToBeClickable(locator)).click();
    }
}
04

A login page object and a test

The page object hides locators and returns the next page after a successful action.

public class LoginPage extends BasePage {
    private final By email = By.id("email");
    private final By password = By.id("password");
    private final By loginButton = By.id("login");
    private final By error = By.cssSelector(".error-message");

    public LoginPage(WebDriver driver) { super(driver); }

    public LoginPage open(String baseUrl) {
        driver.get(baseUrl + "/login");
        return this;
    }

    public DashboardPage loginAs(String user, String pass) {
        type(email, user);
        type(password, pass);
        click(loginButton);
        return new DashboardPage(driver);
    }
}
05

PageFactory and its status

Selenium offers PageFactory with the @FindBy annotation to initialise elements declared as fields. It reduces boilerplate and can cache or lazily locate elements. Many teams prefer plain By locators with explicit waits, as in the example above, because they are simple, work well with dynamic pages and are easy to debug. Check the current Selenium documentation for the status of PageFactory in your version before standardising on it, and apply whichever approach your team picks consistently.

06

Design rules for good page objects

  • → Page classes contain locators and actions, not assertions about business rules.
  • → Methods return the next page object when navigation happens, or the same page when it does not.
  • → Name methods after user intent, such as submitOrder, not clickButton3.
  • → Prefer stable locators such as ids, data-test attributes or accessible names over long XPath chains.
  • → Use explicit waits in the base class instead of fixed sleeps.
  • → Model reusable components, such as a navigation bar, as their own classes.
07

Locator strategy comparison

Locator Stability Note
Dedicated test attribute (data-test) High Best, agree with developers to add them
ID High if not auto-generated Fast and clear
Name or accessible label Medium to high Tied to meaning, not layout
CSS selector Medium Keep short and specific
XPath with positions Low Breaks easily with layout changes
08

Common mistakes

What to avoid

  • Assertions buried in page classes that hide what a test verifies.
  • Huge page classes covering several pages; split into components.
  • Fragile XPath locators.
  • Static driver fields that break parallel runs.
  • Fixed sleeps in page methods.
09

Common component objects

Component Typical methods
Header or navigation bar openMenu, search, goToCart
Modal dialog confirm, cancel, readMessage
Data table getRowCount, findRowByText, sortBy
Date picker selectDate, clearDate
10

Refactoring existing scripts to POM

  1. Pick one flow, such as login, and copy its locators into a new class.
  2. Move the actions into methods named by intent.
  3. Replace the old script lines with the new calls.
  4. Run the test and compare results.
  5. Repeat flow by flow rather than rewriting everything at once.
11

When POM may be more than you need

A throwaway script for one-time use. A very small project with one or two pages. In these cases keep the code simple, and introduce page objects when duplication starts to hurt.

Learn with a trainer

Ready to design Selenium page objects that actually survive UI changes? Explore Uncodemy's Software Testing course or book a free demo and learn from industry trainers.

View Course
About these PDFs: These PDFs are study material for learning and revision. They are not a certificate, a degree or a promise of a job, and technology changes, so check official documentation for the latest details. Spot an error? Write to info@uncodemy.com and the trainer team will review it.
FAQ

Frequently Asked Questions

What is the Page Object Model in Selenium?
It is a design pattern where each page or component is a class holding its locators and user actions, so tests stay clean and maintenance is centralised.
What are the advantages of POM?
Less duplication, easier maintenance, more readable tests, better reuse and clear separation between test logic and page details.
Should assertions go inside page objects?
Generally no. Keep assertions in tests so it is clear what each test verifies, and let page objects expose state, such as text or visibility.
What is PageFactory?
PageFactory is a Selenium support class that initialises elements declared with the FindBy annotation. Many teams use plain By locators with explicit waits instead.
Can POM be used with Cucumber or TestNG?
Yes. Step definitions in Cucumber and test methods in TestNG both call page object methods.
Are these PDFs free to download?
Yes. All Selenium POM guide PDFs on this page are free to download. No form is required — just click the download button on any card above. If a form is ever introduced, a consent checkbox and a link to our Privacy Policy will be added in line with the DPDP Act 2023.