Then the "item" field should not contain "value"

This step asserts that a form field does not contain specific text. It takes two quoted arguments: the field to inspect and the text that must be absent. The field can be identified by a CSS selector (a value starting with # or .) or by its visible label text: when a label is used and it carries a for attribute, the step follows it to the associated form control automatically.

The step waits up to 5 seconds for the field to appear, reads its current value, and fails if the given text is found anywhere inside it (a substring check). The leading the is optional. The field itself must exist on the page: if the selector or label matches nothing, the step fails on the wait rather than on the content check. Use it to prove a field was cleared, was never prefilled, or no longer holds an old value after an edit.

Accepted phrasings

Then the "<field>" field should not contain "<text>"
Then "<field>" field should not contain "<text>"
And the "<field>" field should not contain "<text>"

Examples

Then the "#username" field should not contain "John Smith"
Then the "Email" field should not contain "old-address@example.org"
And the "Subject" field should not contain "Draft"
And the ".search-input" field should not contain "previous query"

In a real scenario

Feature: Contact form reset

  Scenario: Submitting the form clears the previous input
    Given I am an anonymous user
     When I go to "/contact-us"
      And I fill in "Support request" for "Subject"
      And I fill in "user@example.org" for "Email"
      And I press the "Send message" button
      And wait
     Then I should see "Your message has been sent"
      And the "Subject" field should not contain "Support request"
      And the "Email" field should not contain "user@example.org"

Related steps

Back to Assertion Steps