This step fills an input field by locating it through its visible label, placeholder text, or name attribute. You provide the field identifier and the text to type. The field is cleared first, then the new value is entered. Matching is exact and case-sensitive: "Email" does not match a label rendered as "email".
Both I and we pronouns are accepted, and the step may be introduced with Given, When, or And. To target a field that has no accessible label, use the attribute variant instead (see Related steps). Passing an empty string for the value clears the field.
Accepted phrasings
When I fill in "FIELD" with "VALUE"
When we fill in "FIELD" with "VALUE"
And I fill in "FIELD" with "VALUE"
Given I fill in "FIELD" with "VALUE"
Examples
When I fill in "Username" with "John Smith"
When I fill in "Email" with "jon@example.org"
And we fill in "Organization" with "Example Corp"
And I fill in "Password" with "s3cret"
In a real scenario
Scenario: Visitor logs in with valid credentials
Given I am an anonymous user
And I go to "/user/login"
When I fill in "Username or email address" with "alice"
And I fill in "Password" with "s3cret"
And I press the "Log in" button
And wait
Then I should see "alice"