Navigation in Playwright
From the Playwright cheat sheet ยท Navigation & Waiting ยท verified Jul 2026
Navigation
Navigate between pages and wait for load states
typescript
// Navigate to URL
await page.goto('/products');
// Wait for navigation after click
await page.getByRole('link', { name: 'Products' }).click();
await page.waitForURL('/products');
// Go back/forward
await page.goBack();
await page.goForward();๐ก Playwright auto-waits for navigation to complete โ manual waits are rarely needed
โก Use waitForResponse to synchronize on API calls triggered by user actions
๐ Avoid waitForTimeout (sleep) โ prefer waiting on specific conditions like URL or element state
๐ข waitUntil: "networkidle" waits for no network requests for 500ms โ useful for SPAs
navigationwaitgoto