Then I should not see "value" in the "text" element

This step asserts that a specific element does not contain a given piece of text. It takes two quoted arguments: the text that must be absent and the element to inspect. The element can be identified either by a CSS selector or by its visible label text: when the label matches a form label with a for attribute, the step follows it to the associated form control, so "Username" resolves to the input the label points at.

The step waits up to 5 seconds for the element to appear, then reads its text content and fails if the unwanted text is found anywhere inside it. The target element itself must exist; if it never appears the step fails on the wait, not the text check. This makes the step ideal for proving that a scoped region does not show stale or incorrect data while the region itself is present.

Accepted phrasings

Then I should not see "<text>" in the "<element>" element
Then we should not see "<text>" in the "<element>" element
Then should not see "<text>" in "<element>" element
And I should not see "<text>" in the "<element>" element

Examples

Then I should not see "Joe Smith" in the "Username" element
Then I should not see "Draft" in the "#status" element
And we should not see "admin" in the ".author-name" element
And I should not see "0 results" in the "#search-summary" element

In a real scenario

Feature: Profile update

  Scenario: Updated display name replaces the old one
    Given I am a logged in user with the "editor" user
     When I go to "/user/profile/edit"
      And I fill in "John Smith" for "Display name"
      And I press the "Save" button
      And wait
     Then I should see "The changes have been saved"
      And I should see "John Smith" in the "Username" element
      And I should not see "Joe Smith" in the "Username" element

Related steps

Back to Assertion Steps