StrikekitStrikekit

Find hints

Force a single resolve strategy with by aria-label, by role, and related hints

Optional find hints force one resolve strategy for the preceding target label. Place them immediately after the primary target (before with / in / in row / value / state tasks).

Without a find hint, StrikeTest auto-finds the element.

Available hints

HintMeaningExample
by aria-labelMatch aria-label onlyWhen I click on "Security" by aria-label
by data-testidMatch data-testid onlyWhen I click on "save-account" by data-testid
by idMatch element id onlyWhen I hover on "Profile" by id
by nameMatch name attribute onlyWhen I fill "email" by name with "a@b.com"
by textMatch visible text onlyWhen I click on "Login" by text
by role "…"Role plus accessible name / text (role is quoted)When I click on "Security" by role "tab"

Rules

  • One find strategy per step.
  • Find by … is not the same as assert attribute "…" value "…" (which reads an HTML attribute after resolve).
  • For should have "…" values "…" sum equal "…", the find hint applies to the container only; the total label uses auto-find.

Examples

When I fill "Email" by aria-label with "a@b.com"
When I click on "Security" by role "tab"
Then I should have "username" by id value "chamodh" be enabled
And I wait for "dashboard" by data-testid

On this page