Playwright Online Tutorial & Interactive Guide

1 of 124
basicnavigation

page.goto(url)

Navigate the browser to a specific URL.

Instructs the browser tab to load a target website. It waits for the page load event by default before resolving.

Code Integration

Syntax: await page.goto(url, options);
import { test, expect } from '@playwright/test';

test('navigate to login page', async ({ page }) => {
  // Navigate to the target URL
  await page.goto('https://playwrightpad.dev/login');

  // Assert the URL is correct
  await expect(page).toHaveURL(/.*login/);
});

When to Use

Use this at the beginning of your test or after performing an action that opens a new tab/session to set the starting page.

Best Practice

Specify relative paths in your goto calls (e.g. `/login`) and configure a `baseURL` in your `playwright.config.ts` so your tests easily run across staging, development, and production environments.

Motion Simulation Visualizer

Playwright Engine Mock
https://playwrightpad.com/login

Login Portal

YOUR TURN ⚡Practice Mode

Practice: page.goto(url)

Navigate the browser page to the URL 'https://playwrightpad.com/login'.

Playwright Script EditorJavaScript / TypeScript