PW Playwright · TSFree course: Playwright with TypeScript
Full course

Chapter 4 · Lesson 2

Record a login to the practice site

Difficulty: Medium
Slides
Use the arrow keys, N for notes, F for full screenOpen in a separate window ↗
Video lesson

Key points

We will record a short scenario: logging in to the practice site with user_basic.

Hands-on exercise

  1. Run npx playwright codegen https://playground.atidcollege.co.il/.
  2. In the browser window, click the Username field and type user_basic.
  3. Click the Password field and type secret.
  4. Click Login.
  5. In the toolbar click Assert visibility and then the ATID Automation Playground heading. This adds a check: not just doing, but also verifying.
  6. In the Inspector click Copy, or close the window if you used -o.

Open the practice site

Good to know

  • Click slowly. Every click and keystroke is recorded.
  • Clicked by mistake? You can delete a line of code after recording.
  • Other demo users (user_locked, user_expired) show an error message. Try recording them too, and check the message with Assert text.

Practice

Try it yourself