Framework Basics

Page Object Model(POM)

Learning Outcome

6

Update locators easily when the application UI changes.

5

Improve code reusability and maintainability.

4

Use page objects in TestNG test cases

3

Define locators and actions inside page classes.

2

Create Page Classes for web pages.

1

Understand the purpose and structure of POM.

Recall

Locators – Identify and locate web elements.

Web Element Actions interact with webpage elements.

Assertions – Validate expected results.

TestNG – Organize and execute test cases.

Java Classes & Methods – Create reusable code components.

Page Navigation – Move between different application pages.

Restaurant Organization System

Imagine a restaurant where everything is organized into separate sections:

Menu Section

 Contains all food items.

Order Section 

 Handles placing and modifying orders.

Payment Section 

Handles payment actions.

Customer Section → Handles customer details.

Similarly, in Playwright:

Page Class → Represents one application page

Locators → Identify elements on that page.

Methods → Define actions performed on those elements.

Test Class → Uses these page classes to execute test scenarios.

 LoginPage

MenuPage

CartPage

CheckoutPage

Just as a restaurant keeps each responsibility organized, POM keeps locators and actions organized by page, making automation easier to reuse and maintain.

Why is POM Required  ?

POM is required in Playwright to make automation organized, reusable, and easy to maintain

Code Reusability 

Easy Maintenance

Less Code Duplication

Reuse page actions across multiple tests.

Update locators in one place.

Avoid writing the same actions repeatedly.

Better Organization

Easy Debugging 

Scalability

Keep page elements and actions separate from test cases.

Identify and fix issues within a specific page class.

Makes large automation projects easier to manage.

If the Login button changes, update its locator only in LoginPage, instead of changing it in every test.

 What is POM?

 

Page Object Model (POM) is a design pattern used in Playwright automation to organize web-page elements and their actions into separate classes.

example

LoginPage → username, password, login button

MenuPage → food items, search, add to cart

CartPage → cart items, checkout button

TestClass → uses these page classes to perform the test

 POM separates page-related code from test-related code, making the automation framework easier to reuse and maintain

POM Structure in Playwright

A typical POM framework is organized like this

Page Classes → Store locators and actions for each page.

Test Classes → Execute test scenarios using page classes.

Core Concepts (Slide 7)

Core Concepts (.....Slide N-3)

Summary

5

Build strong branding

4

Use different marketing channels

3

Target the right audience

2

Create and communicate value

1

Understand customer needs

Choose cool, soft colors instead of vibrant colors
Max 5 Points for Summary & Min 2

Quiz

Which platform is mainly used for professional networking and B2B marketing ?

A. Facebook

B. Instagram

C. LinkedIn

D. Snapchat

Quiz-Answer

Which platform is mainly used for professional networking and B2B marketing ?

A. Facebook

B. Instagram

C. LinkedIn

D. Snapchat

Page Object Model(POM)

By Content ITV

Page Object Model(POM)

  • 16