Then I should see (a/an) "field" element

This step asserts that an element identified by its visible label text exists and is visible on the current page. It takes one quoted argument: the label text of the element you expect to see, matched exactly. If the matched text is a form label with a for attribute, the step follows that attribute and waits for the associated form control to become visible instead, which makes it a natural fit for checking that form fields are present.

The step waits up to 3 seconds for the element to become visible before failing. You can write a or an before the quoted label; both are accepted. To find elements by an attribute such as id, name, or class rather than by label text, use the "element by attribute" variant instead.

Accepted phrasings

Then I should see a "<label>" element
Then I should see an "<label>" element
Then we should see a "<label>" element
Then should see an "<label>" element
And I should see a "<label>" element

Examples

Then I should see a "Username" element
And we should see an "Email" element
And I should see a "Phone number" element
And I should see a "Message" element

In a real scenario

Feature: Contact form

  Scenario: Check that all contact form fields are present
    Given I am an anonymous user
     When I go to "/contact-us"
      And wait
     Then I should see a "First Name" element
      And I should see a "Last name" element
      And I should see a "Company name" element
      And I should see an "Email" element
      And I should see a "Phone number" element
      And I should see a "Subject" element
      And I should see a "Message" element

Related steps

Back to Assertion Steps