TestingDocs.com logoTestingDocs.com
Automation learning lab
TestingDocs • Self-paced course

Playwright Automation
Self Study Guide

Start from zero. Learn JavaScript and TypeScript, automate browsers, and build reliable end-to-end tests.

60 chaptersBeginner friendlyHands-on practice
Playwright / Chapter 36 of 60~18 min • Beginner
Chapter 36Playwright

Navigation and pages

page.goto navigates to an absolute URL or a relative URL when baseURL is configured. Use page.url or a web-first URL assertion to check navigation. A page represents a browser tab or popup. Avoid relying on arbitrary waits after navigation.

How it works

Step-by-step walkthrough

  1. Navigate to a public demo
  2. Check the URL
  3. Inspect the page title

Example

TypeScript
import { test, expect } from '@playwright/test';
test('open demo', async ({ page }) => {
  await page.goto('https://example.com/');
  await expect(page).toHaveTitle(/Example Domain/);
});
Expected result: Title contains Example Domain
💡 Point to remember
External websites can change; prefer a controlled test environment.

✎ Your practice task

Try another permitted demo URL and update the expected title.

Knowledge check

Which method navigates to a URL?

🌐 Continue learning