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

This step asserts that an element identified by its label text is not present on the current page. It takes one quoted argument: the label text that must be absent. In the negative form the step reads the full text of the page body and fails if the given text appears anywhere in it, so it behaves as a page-wide absence check on the label.

You can write a or an before the quoted label; both are accepted. Because the negative form checks the whole body text, choose a label string that is specific enough not to appear elsewhere on the page by coincidence. To assert the absence of an element identified by an attribute such as id or class, use the "element by attribute" variant instead.

Accepted phrasings

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

Examples

Then I should not see a "Username" element
Then I should not see an "errorMsg" element
And we should not see a "Delete account" element
And I should not see an "Admin notes" element

In a real scenario

Feature: Registration policy

  Scenario: Self-registration fields are hidden for visitors
    Given I am an anonymous user
     When I go to "/user/login"
      And wait
     Then I should see "Log in"
      And I should see a "Username" element
      And I should see a "Password" element
      And I should not see a "Create new account" element
      And I should not see an "Admin notes" element

Related steps

Back to Assertion Steps