Software Testing / Learning brief

Tom asks for the button by its job

What this means in plain language

Tom writes his first Playwright test. Leo restyles the page and Tom's old locators break. A crowd at a station shows why asking for an element by its job keeps a test steady when a page changes.

Understand the full idea, step by step

You are meeting a friend at a busy station. You can say "look for the red coat". Or you can say "look for the person at the ticket desk". The coat can change in a minute. The job stays.

Tom has the same choice in his first Playwright test. Playwright is a free tool that drives a real web browser. He must press the Add task button of Daily List, a to-do list app.

PLAIN WORDS · 1 in this section
playwright
a free Microsoft tool that drives a browser for tests

Evidence & review

REVIEWED 2026-10-18

The date on this lesson is when it went up on Payments Signal, not when its material was written — most of these were brought across from an earlier catalogue in a single run, which is why so many of them share a date. What the lesson says about the world is dated by the review above and by the sources below it.

Playwright locators as taught in this academy, with an invented app and invented people. Playwright changes often, so check the current guide.

What this brief simplifies: Fiction labelled SYNTHETIC / TRAINING ONLY. Sources were seen only as search excerpts, and no real run was made. The crowd is a teaching picture.

Sources for this brief — 5 sources
  1. Market practice

    Locators (Playwright documentation) ↗ — Microsoft (Playwright) · Role locators are the preferred choice; label locators suit form fields; text locators suit non-interactive elements; test ids are a resilient fallback, and the attribute can be changed with testIdAttribute (search excerpt, page not opened)

    Says role locators are the preferred choice because they match how users and assistive tools see the page, label locators suit form fields, text locators suit non-interactive elements, and test ids are the most resilient fallback when role or text cannot be used. Says the test id attribute is data-testid by default and can be changed with testIdAttribute. Says a matching locator that resolves to more than one element throws in strict mode for actions, and that first, last and nth are not recommended. Vendor documentation for one tool. Practitioner guidance, not a standard. · Checked 2026-11-06

    Primary source opened and operative text inspected on 6 November 2026. Scope: Complete extracted primary article; examples inspected, not executed. Current live Playwright documentation reflects 1.65 where stated; explicit older examples retain their version. Source inspection is not an execution or compatibility-test claim. See the completed v45 Playwright analysis for source discrepancies and exact reading boundaries.

  2. Market practice

    Best practices (Playwright documentation) ↗ — Microsoft (Playwright) · Prefer user-facing locators such as role-based ones over CSS or XPath, because the page structure can change (search excerpt, page not opened)

    Recommends user-facing locators such as role-based ones over Cascading Style Sheets (CSS) or XPath, web-first assertions that retry, and avoiding fixed waits. Vendor documentation. Practitioner or vendor guidance, not a standard unless stated. · Checked 2026-10-18

    Found through a web search; the page was not opened (search excerpt, page not opened). Version: Web page, no edition number. Licence terms were not read, so put it in your own words and do not quote it. Open the page and confirm what it says before relying on any detail. A second search on 2026-10-20 returned this page for its title and matched the described content; the page was still not opened (search excerpt, page not opened).

  3. Market practice

    Accessible Rich Internet Applications (ARIA) 1.2 ↗ — World Wide Web Consortium (W3C) · Roles are defined in a standard, and some roles need an accessible name (search excerpt, page not opened)

    Roles, states and properties, and which roles need an accessible name. · Checked 2026-10-18

    Found through a web search; the page was not opened (search excerpt, page not opened). Version: World Wide Web Consortium (W3C) Recommendation, 2023. Licence terms were not read, so put it in your own words and do not quote it. Open the page and confirm what it says before relying on any detail.

  4. Market practice

    Using Accessible Rich Internet Applications (ARIA) (W3C Working Group Note) ↗ — World Wide Web Consortium (W3C) · Use a native HTML element when one gives the meaning and behaviour needed (search excerpt, page not opened)

    The first rule of Accessible Rich Internet Applications (ARIA): use a native HyperText Markup Language (HTML) element when one gives the meaning and behaviour needed. · Checked 2026-10-18

    Found through a web search; the page was not opened (search excerpt, page not opened). Version: World Wide Web Consortium (W3C) Working Group Note. Licence terms were not read, so put it in your own words and do not quote it. Open the page and confirm what it says before relying on any detail.

  5. Simplified educational illustration

    Payments Signal editorial teaching models — Payments Signal

    This site's own simplified teaching models. · Checked 2026-07-12

    Used wherever diagrams, scenarios, figures, or example values are didactic constructions rather than sourced facts; every such use carries a simplifications disclosure. All people, companies, banks, and list entries in examples are fictional.

Learn this properly

START HEREFinding elements: getByRole, getByLabel, getByText and test idsAsk for an element by its job, its label or its words, as a person would, and keep test ids for when nothing else fits.Opens at L0 Explain simply · about 18 min

Related briefs

Tom asks the shop for its stock list

Tom has written permission to test Daily List's GraphQL feed on the test site. A shop story walks through five small checks and the finding that a lockout counted requests and not tries.

READ BRIEF