Playwright · Junior · Question 37 of 75

How do you assert that an error message is NOT shown?

Show the answer

Correct answer: await expect(error).not.toBeVisible()

Explanation

.not inverts any matcher and still retries. toBeHidden() is an equivalent that passes for hidden or absent elements.

Further reading

Problem with a question

Playwright · Junior · question 37

Test yourself

Take the Playwright · Junior quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz