Key points
Codegen is Playwright's recording tool. You open a browser, do actions yourself, and the tool writes the code.
npx playwright codegen https://playground.atidcollege.co.il/
Two windows open:
- The browser window where you act, with a small toolbar.
- Playwright Inspector, where the code appears in real time, with Record, Copy, Clear buttons and a language selector.
Save straight to a file
The -o flag saves the generated code to a file: npx playwright codegen -o tests/login.spec.ts <address>.