Then I should see "text in the page"

This step asserts that a given string of text is present anywhere in the <body> of the current page. It waits up to five seconds for the text to appear. This makes it suitable for pages where content loads asynchronously after navigation.

The match is a substring check on the page text as Playwright's text matching reads it (since 2.0.12): letter case is ignored, runs of white space are collapsed, and the text of hidden elements counts, but not the text of <script>, <noscript> or <style>; the value of a field, the text of an image and the content of an iframe are not page text. For the text a visitor can see, with its letter case, use I wait for the text "text" to appear. Both I and we are accepted as the subject, and the step can be introduced with Then, And, or But. If you need to assert text is absent, use the companion step Then I should not see instead.

Accepted phrasings

Then I should see "text"
Then we should see "text"
And I should see "text"
And we should see "text"

Examples

Then I should see "Welcome"
Then we should see "Your accounts for the group is public"
And I should see "Dashboard"
And I should see "Log in"

In a real scenario

Scenario: Check that the admin dashboard is accessible after login
  Given I am a logged in user with the "webmaster" user
   When I go to "/admin/dashboard"
    And wait
   Then I should see "Dashboard"
    And I should see "Recent pages"
    And I should see "Recent content"

Related steps

Back to Assertion Steps