lecture 14 of 200 completed

Multiple tabs and pop-up windows

A link that opens a new tab breaks a naive test. Playwright makes you catch the new page before it appears.

What you'll learn

  • How to catch a tab that opens from a click
  • Why the listener has to start before the click
  • When not to test the new tab at all

A test clicks "View invoice" and then looks for the invoice number. It fails, saying the element is not there.

The invoice opened in a new tab. Your test is still looking at the old one. Playwright did not follow the click, because pages do not automatically become the active one.

The fix has one detail that catches everybody, so read the order carefully.

members only

Keep reading with the full course

The Foundations track and the first 5 lectures of each framework are free. This lecture is part of the paid course, which unlocks every lecture, all three frameworks, and downloads.

See the options →