Practice Widgets Windows & Tabs
New page event
Widget practice · Multi-context

Open new windows & tabs

Four triggers — anchor target="_blank", window.open(), multi-tab spawn, and a noopener variant. Practise context.waitForEvent('page'), Promise.all, and asserting against the second Page object.

① Anchor with target="_blank"

Standard cross-tab link. The browser opens a new tab pointing at ./tab-popup.html.

Open via target="_blank"
id=anchor-blank data-testid=open-anchor target=_blank · rel=noopener

window.open() popup

Programmatic open via JS. Most browsers allow it inside a user-gesture handler.

id=open-popup · open-popup-named data-testid=open-popup · open-popup-named window.open(url, name, features)

③ Open three tabs at once

Fires three window.open() calls in a row. Use it to practise iterating context.pages().

data-testid=open-three asserts=context.pages().length === 4 (incl. main)

noopener variant — no window.opener

Secure flavour: the new tab cannot reach back to window.opener. Useful for verifying security headers in tests.

Open noopener
id=anchor-noopener rel=noopener noreferrer
No window event yet.