Playwright

Assert element text content

Easy30 pts
  • toHaveText
  • toContainText
  • Text Matching
  • Web-first Assertions
Practice app · TargetQA Practice Store

A small storefront landing page for browser setup, navigation, titles, URLs and screenshots.

Test URL
/lab/playwright-assert-element-text-content

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

Objective

Validate the exact and partial text content of headings and banners using text assertions.

Your Task

  1. 1Navigate to the practice store home page at TEST_URL.
  2. 2Assert that the main heading (#page-title) has the exact text 'Welcome to the practice store'.
  3. 3Assert that the hero banner (#hero-banner) contains the text 'TargetQA'.

Validation Checks

  • Practice store home page is loaded at TEST_URL
  • Main heading (#page-title) has exact text 'Welcome to the practice store'
  • Hero banner (#hero-banner) contains 'TargetQA'
  • At least 2 assertions pass

Playwright · Playwright Practice Track · Assertions