fill
Type into a labeled input field
Fill a field identified by its label (or find hint). The value after with is a payload — a * there is a literal character, not a glob.
Syntax
When I fill "<target>" [by …] with "<value>"Qualifiers
| Qualifier | Role | Example |
|---|---|---|
with | Value to type | fill "username" with "chamodh" |
by aria-label / by data-testid / by id / by name / by text / by role "…" / by attribute | Optional find hint after the target | fill "Email" by aria-label with "a@b.com" · fill "my-custom-hook" by attribute with "Zoe" |
Only one find strategy per step. Without by …, StrikeTest auto-finds the field (including late unique data-* attribute presence on web — see Find hints).
Requirements
| Item | Contract |
|---|---|
| Element / control shape | input or textarea only (id, name, placeholder, aria-label, data-testid on those tags). Not contenteditable divs or custom editors. |
| How the label binds | id → input/textarea data-testid → input/textarea aria-label → input name → input placeholder → textarea name → textarea placeholder (+ late unique data-* on web) |
| Qualifiers that change resolve | by … forces a single strategy on the target; with value is a payload (* stays literal) |
| Platform | Web and mobile (same label grammar) |
| Wrong shape → use instead | Contenteditable / rich-text widgets → expose a native input or test hook. Custom combobox → open / pick, not fill alone. |
When it fails
- Timeout / not found — label missed or control is not an
input/textarea. element is disabled— field is disabled.- Ambiguous — more than one matching field.
See also UI contracts.
Examples
When I fill "username" with "chamodh"
And I fill "password" with "1234"
When I fill "email" by name with "a@b.com"
When I fill "data-employee-name" by attribute with "Ada"
When I fill "my-custom-hook" by attribute with "Zoe"
When I fill "search" with "a*b"Notes
- Target
"username"is a match/lookup label —*in the target acts as a glob and must resolve to exactly one visible field. - Works on web and mobile (same label grammar).
Related
- click
- clear
- Find hints
- UI contracts
- should — assert value after fill