Playwright

Target elements by text

Easy30 pts
  • getByText
  • Visible Content
  • Text Locators
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-text

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

Objective

Locate page content by visible text and verify the promotion banner is displayed.

Your Task

  1. 1Navigate to the practice catalog page at TEST_URL.
  2. 2Locate the promotional banner by its visible text containing 'Free shipping over $40'.
  3. 3Assert that the promotional banner (#promo-banner) is visible on the page.

Validation Checks

  • Practice catalog application is loaded at TEST_URL
  • Promotional banner is located using its visible text
  • Promotional banner (#promo-banner) is verified as visible
  • At least 1 assertion passes

Playwright · Playwright Practice Track · Locators & auto-waiting