Selenium WebDriver 4

Capture a screenshot of the page

Medium70 pts~25 min
  • Screenshots
  • Test evidence
Practice app · TargetQA Practice Store

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

Test URL
/lab/selenium-capture-a-screenshot-of-the-page

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

Objective

Save evidence of the page state as a screenshot file.

Your task

  1. 1Open TEST_URL and assert #hero-banner is displayed.
  2. 2Capture a full-viewport screenshot and save it as a PNG file.
  3. 3Optionally capture only the #hero-banner element.
  4. 4Assert the screenshot bytes or file are not empty.

Acceptance criteria

  • A screenshot is captured
  • #hero-banner is visible
  • At least 2 assertions pass

Selenium WebDriver 4 · Selenium · Setup & first script