Playwright

Capture screenshots on failure

Medium70 pts
  • screenshot
  • Failure Capture
  • Artifacts
Practice app · TargetQA Practice Store

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

Test URL
/lab/playwright-capture-screenshots-on-failure

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

Objective

Capture screenshot artifacts during test execution to diagnose failures.

Your Task

  1. 1Navigate to the store home page.
  2. 2Assert that #page-title is visible.
  3. 3Capture a screenshot of the page and save it to 'failure.png'.

Validation Checks

  • Page navigation and #page-title visibility are verified
  • Screenshot artifact is captured to 'failure.png'
  • At least 1 assertion passes

Playwright · Playwright Practice Track · Debugging & traces