Playwright

Target elements by placeholder

Easy30 pts
  • getByPlaceholder
  • Search Fields
  • Form Inputs
Practice app · Practice Catalog

A product catalog with ids, names, classes, links, data-testids and duplicate buttons for locator practice.

Test URL
/lab/playwright-target-elements-by-placeholder

Your starter code already declares TEST_URL — never hardcode a host.

Objective

Locate an input field using its placeholder attribute and fill in a search query.

Your Task

  1. 1Navigate to the practice catalog page at TEST_URL.
  2. 2Locate the search input field by its placeholder text 'Search products'.
  3. 3Fill the search field with 'Playwright Tee'.
  4. 4Assert that the search input (#search-input) has value 'Playwright Tee'.

Validation Checks

  • Practice catalog application is loaded at TEST_URL
  • Search input is located by its placeholder 'Search products'
  • Search input is filled with 'Playwright Tee'
  • Search input (#search-input) has value 'Playwright Tee'
  • At least 1 assertion passes

Playwright · Playwright Practice Track · Locators & auto-waiting