Playwright · Junior · Question 35 of 75

Which assertion checks that the browser is on the dashboard page?

Show the answer

Correct answer: await expect(page).toHaveURL(/dashboard/)

Explanation

toHaveURL waits for navigation and accepts a string or a regular expression. Comparing page.url() directly doesn't retry.

Further reading

Problem with a question

Playwright · Junior · question 35

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