Skip to content
CodeKruPro

Fill Input Fields

15/70

Fill Input Fields

Playwright provides two ways to enter text:

  • locator.fill(value) — clears the field first, then types the value (recommended)
  • locator.pressSequentially(text) — types one character at a time (simulates real typing)

Task:

  1. Navigate to https://testkru.com/Elements/TextFields
  2. Find the last name field (ID: lastNameWithPlaceholder)
  3. Fill it with "Playwright"
  4. Print its value
  5. Clear it and fill with "Automation"
  6. Print its new value

Expected output:

First fill: Playwright
Second fill: Automation