From 35d635778a0ddea36e012f885eaa5ae5862b6fef Mon Sep 17 00:00:00 2001 From: DavertMik Date: Wed, 9 Sep 2026 03:09:31 +0300 Subject: [PATCH] refactor(locator): find ARIA checkables in Locator, not in each helper MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Locator.checkable already knows how to find a control by its label. It just hard-coded the tag. Headless component libraries express the same semantics with a role, so generalise the tag test to a tag-or-role test and skip aria-hidden elements. self::input[@type='checkbox' or @type='radio'] or @role='checkbox' or @role='radio' or @role='switch' This replaces the three per-helper implementations added in #5704 — a getByRole loop in Playwright, a role-scoped ::-p-aria loop in Puppeteer, and a hoisted aria/ lookup plus keepCheckable filter in WebDriver — with one XPath predicate that all three helpers inherit, since they all call Locator.checkable.byText. Puppeteer's and WebDriver's ARIA fallbacks return to their original position after the XPath. An XPath predicate is role-scoped by construction, so there is no precision trade-off to manage: a heading sharing the label text cannot match, and the per-helper filtering that guarded against it is no longer needed. The aria-hidden guard is what skips the hidden mirror input that libraries render and point