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
| Hint | Meaning | Example |
|---|---|---|
by aria-label | Match aria-label only | When I click on "Security" by aria-label |
by data-testid | Match data-testid only | When I click on "save-account" by data-testid |
by id | Match element id only | When I hover on "Profile" by id |
by name | Match name attribute only | When I fill "email" by name with "a@b.com" |
by text | Match visible text only | When 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 assertattribute "…" 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