Playwright lab
Popups & multiple tabs
window.open popups, target=_blank tabs and a two-tab chat that talks over BroadcastChannel.
Practice tasks
- Use page.waitForEvent('popup') around the Open popup button and assert the popup's heading.
- Use context.waitForEvent('page') for the target=_blank link; call newPage.waitForLoadState().
- Open the page twice in the SAME context, send a chat message from page A and assert it arrives in page B.
- Open it in two DIFFERENT contexts and prove the messages do NOT cross (isolation).
- Close the popup and bring the original page back with page.bringToFront().
- Assert the “tabs online” counter reaches 2 when both pages are open.
- Handle window.opener: assert the popup opened by script has an opener and the noopener link does not.