Playwright

Handle a new page (popup)

Medium70 pts
  • Popups
  • Multiple Tabs
  • waitForEvent page
Practice app · Help Center

Links and buttons that open new tabs and windows.

Test URL
/lab/playwright-handle-a-new-page-popup

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

Objective

Capture and interact with a newly opened browser tab or window using context.waitForEvent('page').

Your Task

  1. 1Navigate to the multi-window workspace at TEST_URL.
  2. 2Set up an asynchronous listener for a new page event on the browser context.
  3. 3Click the open new window button (#open-window).
  4. 4Await the newly opened page instance.
  5. 5Assert that the new page has the document title 'Help Center | TargetQA Practice'.

Validation Checks

  • Multi-window workspace is loaded at TEST_URL
  • Page event listener is registered on browser context
  • Open window button (#open-window) is clicked
  • New page is awaited and title verified as 'Help Center | TargetQA Practice'
  • At least 1 assertion passes

Playwright · Playwright Practice Track · Actions & inputs