page-object-model

Convert ad hoc selectors into reusable page objects for Playwright test suites.

Updated Aug 23, 2026
One-click install
npx skills add https://github.com/kirillshilin/instructions --skill page-object-model-kirillshilin
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: page-object-model
Source: https://github.com/kirillshilin/instructions/tree/main/obsolete/claude/skills/page-object-model
Command: npx skills add https://github.com/kirillshilin/instructions --skill page-object-model-kirillshilin

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Page Object Model (POM) patterns help organize UI tests by encapsulating interactions behind reusable page classes, reducing duplication and fragility.

Core Features & Use Cases

  • Create a dedicated page object per page or major component (modal, form, navbar) to centralize interactions.
  • Use resilient locators with a defined priority order to improve stability across navigations and renders.
  • Migrate existing specs from raw selectors to page objects to simplify maintenance and readability.
  • Provide a goto() method and clear action methods for navigation and user interactions.

Quick Start

Create a new Page Object class for the target page and implement a goto() method along with action methods, then refactor specs to use the page object.

Frequently Asked Questions about page-object-model

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I refactor raw Playwright selectors into reusable page objects?

Refactor raw Playwright selectors by encapsulating them in dedicated page classes with private getters and action methods. This centralizes interactions, reducing selector duplication and test fragility across renders.

What is the Page Object Model pattern for UI test automation?

The Page Object Model pattern organizes UI test automation by representing each page or component as a dedicated class. These classes encapsulate interactions and resilient locators behind reusable methods to improve maintainability.

What is the best way to structure a base page class in Playwright?

Structure a Playwright base page class by implementing a goto() method for navigation, private getters for locators, and consistent naming conventions. This pattern promotes maintainability across your test suite.

How do I organize Playwright tests for major components like modals and navbars?

Organize Playwright tests for major components by creating a dedicated page object class for each modal, form, or navbar. This centralizes interactions and locators for those specific UI screens into reusable classes.

Does the Playwright Page Object Model require resilient locator strategies?

Yes, the Playwright Page Object Model requires resilient locator strategies with a defined priority order. Using resilient locators improves test stability across navigations and renders, preventing brittle UI tests.

When should I migrate existing Playwright specs to page objects?

Migrate existing Playwright specs to page objects when test maintenance becomes difficult due to duplicated selectors. Refactoring specs to use page object action methods simplifies readability and centralizes locator management.