Skip to content

Conversation

@biinari
Copy link
Contributor

@biinari biinari commented Oct 3, 2025

Add ability to use a popup window opened by the page.

Example Usage

On a page with an interaction that opens a window or tab:

<button id="open-popup" onclick="window.open('/popup', 'target', 'width=600,height=400')">Open a window</button>

or

<a id="open-popup" href="/popup" target="_blank">Open a tab</a>

Usage:

$page = visit('/');

$popup = $page->pendingPopup();
$page->click('#open-popup');

$popup->assertSee('Text in popup window');
// $popup interactions and assertions will wait for popup to open

Add Page->pendingPopup() to get an object that will resolve to a window opened
by page.
Test popup as new window rather than just a new tab
Test opening a new tab with a link
Check initScript gets run on the popup window so that we
can make assertions for console logs / js errors.
phpstan does not parse multiple classes separated by pipe character '|'
(multiple classes can be specified in multiple @mixin tag lines but in
this case that is not needed as AwaitableWebpage already has a @mixin
for Webpage)
Allow Page to be garbage collected if all other references to
it have gone out of scope.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant