Skip to content
masterclass Buddy

Playwright · Matcher

toHaveURL

expect(page).toHaveURL waits for the page URL to match a string, regular expression, URL pattern, or predicate. Use it to verify navigation and query parameters.

Last updated

Since
v1.20

Syntax

await expect(page).toHaveURL(url, options);

In-depth API docs are only for subscribers: parameters, examples, common mistakes and interview practice.

Subscribe
  • expect
  • PageAssertions.not
  • expect.poll
  • page.getByRole

Source: PageAssertions | Playwright. Checked 2026-11-03.