click
Click a labeled button, link, or control
Click a control by label. Optional container or table-row scoping for one-shot clicks.
Syntax
When I click on "<target>" [by …]
When I click on "<target>" in "<container>"
When I click on "<target>" in row "<row-key>"
When I click on "<header>" columnQualifiers
| Qualifier | Role | Example |
|---|---|---|
on | Target label | click on "Login" |
in | One-shot click inside a container (does not change the in stack) | click on "Delete" in "Laptop" |
in row | Scope to a table row by cell text | click on "Edit" in row "chamodh@example.com" |
column | Prefer columnheader / th text match, then click | click on "Name" column |
by … | Optional find hint after the target | click on "Security" by aria-label · see also Find hints (by attribute, auto data-* presence) |
Requirements
| Item | Contract |
|---|---|
| Element / control shape | Auto-find: any element with matching id, data-testid, or aria-label; or [role=tab] with exact text; or visible text on button / a / input[type=button] only; or input[type=submit][value]. Late unique data-* presence fallback on web. |
| How the label binds | Default order: id → data-testid → aria-label → role tab + text → visible text (button/a/input[type=button]) → submit value |
| Qualifiers that change resolve | by … replaces the auto chain. in / in row use container/row + action sets that include [role=button]. column resolves role=columnheader / th only. |
| Platform | Web (Playwright). Same label grammar on mobile where supported. |
| Wrong shape → use instead | Plain <div>Login</div> fails on visible text. <div role="button">Login</div> fails on default visible-text click — use by text, by role "button", id/testid/aria-label, or click … in / in row. Radix menuitem → click trigger + item by id. |
When it fails
timed out/element not found— often wrong control shape (div without button/link/role), not a typo.ambiguous— duplicate labels or glob matched multiple controls.element is disabled— resolved a disabled control.
See also UI contracts.
Examples
When I click on "Login"
When I click on "Delete" in "Laptop"
When I click on "Edit" in row "chamodh@example.com"
When I click on "Security" by role "tab"
When I click on "Name" column
When I click on "Save*"Notes
"Save*"on the target is a glob — must match exactly one visible control.click on "…" columnprefers column headers and does not change defaultclick onstrategy order.