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 50 of 60~18 min • Beginner
Chapter 50Playwright

Codegen and Inspector

Codegen records actions in a browser and suggests locators and code. The Inspector helps step through a test and inspect locator matches. Generated code is a starting point; review it and add assertions that reflect the actual requirement.

How it works

Step-by-step walkthrough

  1. Launch Codegen on the demo
  2. Record an interaction
  3. Review and refine the generated script

Example

Terminal
npx playwright codegen https://demo.playwright.dev/todomvc/
npx playwright test --debug
Expected result: Recording or debugging window opens
💡 Point to remember
Never record real passwords into generated test scripts.

Screenshot walkthrough

Playwright UI mode (related debugging interface)
Playwright UI mode (related debugging interface) • Official Playwright documentation. Source and walkthrough

✎ Your practice task

Record adding one todo and add a visible-text assertion.

Knowledge check

Should generated code be reviewed before committing?

🌐 Continue learning