Software Testing / Learning brief

Tom deletes the right row

What this means in plain language

Every row of the Today list has a Delete button, and Tom's test deletes the wrong task. A street, a house and a room show how to narrow a locator until only one match is left, and why strict mode helps.

Understand the full idea, step by step

A letter says only "the kitchen". Every house on the street has one, so the postman cannot deliver it. A letter that says "the kitchen at number 12, Mill Street" arrives. Each part makes the search smaller.

Tom's test has the same trouble. It must press Delete in Daily List, a to-do list app. Every row of the Today list has a Delete button.

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 locator narrowing 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 street is a teaching picture.

Sources for this brief — 4 sources
  1. Market practice

    Locators (Playwright documentation) ↗ — Microsoft (Playwright) · Locators are strict: an action on a locator that matches more than one element throws; first, last and nth are not recommended; filter and chaining narrow the match (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

    Locator class reference (Playwright documentation) ↗ — Microsoft (Playwright) · Locator filter takes hasText, hasNotText, has and hasNot; a string matches as a case-insensitive substring; the inner locator of has is matched from the outer one; and() and or() combine locators; count does not throw (search excerpt, page not opened)

    Reference for the Locator class: filter with hasText, hasNotText, has and hasNot (text matching is case-insensitive substring for a string), and, or, locator, nth, first, last, count and all. Says the inner locator of has is matched starting from the outer one. Says hasNot and hasNotText arrived in version 1.33 and and() in version 1.34. Vendor documentation for one tool. Practitioner guidance, not a standard. · 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.

  3. Market practice

    Best practices (Playwright documentation) ↗ — Microsoft (Playwright) · Prefer locators that point at one element in a way that survives page changes (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).

  4. 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 HERENarrowing locators: chaining, filtering, lists and nthWhen a locator matches many rows, search inside one row instead of counting positions, and let strict mode warn you when you were not exact.Opens at L0 Explain simply · about 18 min

Related briefs

Tom picks the right tool

Tom learns to weigh the objective, the risk, the test basis, his own skill and the time before he picks a test technique. A repair job shows him the way.

READ BRIEF