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

Click, fill and keyboard actions

Use click for interactive controls, fill for editable inputs, and press for keyboard keys or shortcuts. fill sets the value and triggers an input event; press sends a key interaction. Actions wait for relevant actionability conditions.

How it works

Step-by-step walkthrough

  1. Create an input
  2. Fill the text
  3. Check the value

Example

TypeScript
import { test, expect } from '@playwright/test';

test('chapter 40 practice', async ({ page }) => {
  await page.setContent('<label>Search <input></label>');
  const input = page.getByLabel('Search');
  await input.fill('Playwright');
  await input.press('End');
  await expect(input).toHaveValue('Playwright');
});
Expected result: Input value is Playwright
💡 Point to remember
Do not use force unless you understand which checks are skipped.

Practice application screenshot

Actual screenshot of the TestingDocs task manager practice application
TestingDocs practice page, captured in Chromium.

✎ Your practice task

Clear the input and verify its empty value.

Knowledge check

Which action sets a text input value?

🌐 Continue learning