po-binding-playwright

Bind Playwright PageObject elements to front-end test IDs using getByTestId.

Updated Nov 8, 2025
One-click install
npx skills add https://github.com/10knamesmore/dotfiles --skill po-binding-playwright
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: po-binding-playwright
Source: https://github.com/10knamesmore/dotfiles/tree/main/general/skills/po-binding-playwright
Command: npx skills add https://github.com/10knamesmore/dotfiles --skill po-binding-playwright

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill enables teams to construct Playwright PageObject bindings by reading front-end test ID mappings and aligning them with existing PO patterns, reducing drift between UI elements and test automation.

Core Features & Use Cases

  • TestID-driven bindings: Bind each UI element to a single, stable data-testid via a PageObject.
  • Top-down mapping: Build containers from page root to panels, dialogs, and tables following a hierarchical approach.
  • Standards enforcement: Prefer data-testid first, avoid XPath, and annotate missing testids with TODOs.
  • PO templating: Produce PO classes that wrap elements with Locator-based access using getByTestId.

Quick Start

Provide the root component directory, review the testid mapping document, generate PO bindings, and integrate them into your Playwright test suite.

Frequently Asked Questions about po-binding-playwright

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

FAQPage Schema
How do I map frontend test IDs to Playwright PageObjects?

To map frontend test IDs to Playwright PageObjects, you construct containers from the root component down to dialogs and tables, using getByTestId Locator wrappers to bind each UI element to a stable data-testid.

What is the best way to structure Playwright PageObject bindings for a large UI hierarchy?

The best way to structure Playwright PageObject bindings is using a top-down hierarchical approach, building containers from the page root to panels and dialogs while enforcing a standard PO template that wraps elements with Locator-based access.

How do I handle missing data-testid attributes when building Playwright PageObjects?

When data-testid attributes are missing during Playwright PageObject construction, the binding process annotates those gaps with TODOs, allowing you to identify and resolve missing test IDs without breaking the existing PO patterns.

Does this PageObject generation approach avoid XPath locators in Playwright?

Yes, this PageObject generation approach enforces a data-testid first standard, preferring getByTestId Locator wrappers and avoiding XPath to reduce drift between UI elements and test automation.

What do I need to start generating Playwright PageObject bindings from testid mappings?

To start generating Playwright PageObject bindings, you need to provide the root component directory and review the testid mapping document, then integrate the produced PO classes into your existing Playwright test suite.

Why use data-testid attributes for Playwright PageObject locators instead of CSS selectors?

Using data-testid attributes for Playwright PageObject locators provides a single, stable binding for each UI element, reducing drift between frontend changes and test automation compared to relying on CSS selectors or XPath.