Playwright: page.goto()

Navigates to a URL in Playwright E2E tests. Part of the Page API for browser automation.

Syntax

testing
await page.goto(url, options)

Example

testing
import { test, expect } from "@playwright/test";

test("home page loads", async ({ page }) => {
  await page.goto("https://localhost:3000");

  await expect(page).toHaveTitle(/DevForge Academy/);
  await expect(page.getByRole("heading", { level: 1 })).toBeVisible();
  await expect(page.getByRole("link", { name: "Get Started" })).toBeEnabled();
});