When I fill in the following:

Fills multiple form fields in one step from a Gherkin data table. Each row is a | label | value | pair: the first column names the field and the second column is typed into it. Fields resolve via their visible label (a <label for=...> association), their placeholder text, or their name attribute - whichever matches first.

This is the most readable way to complete a whole form: one step, one table, no repetition. Rows are filled top to bottom, and each fill replaces any existing content in its field. If any label in the table cannot be resolved, the step fails on that row. When labels are unreliable or duplicated, switch to the by attr variant of this step and target fields by id, name, or a data attribute instead.

Accepted phrasings

When I fill in the following:
When we fill in the following:
When I fill in following:
And I fill in the following:

Examples

When I fill in the following:
| Username | webshipco |
| Password | s3cret    |

When we fill in the following:
| Email        | jon@example.com |
| Organization | Webship.co      |

And I fill in the following:
| First name | Alice  |
| Last name  | Smith  |
| Country    | Jordan |

When I fill in the following:
| Card number | 4242 4242 4242 4242 |
| Expiry      | 12/30               |
| CVV         | 123                 |

In a real scenario

Scenario: Check that a visitor can fill the business contact form
  Given I am an anonymous user
   When I go to "/contact-us"
    And wait
    And I fill in the following:
        | First Name   | Test                   |
        | Last name    | Tester                 |
        | Company name | Example QA             |
        | Subject      | Automated test inquiry |
   Then the field "First Name" should not be empty
    And the field "Subject" should not be empty

Related steps

Back to Form Steps