Skip to content

fix: wait for late iframes in withinFrame() - #326

Open
clarkewing wants to merge 2 commits into
pestphp:5.xfrom
clarkewing:fix-within-frame-late-iframe
Open

clarkewing wants to merge 2 commits into
pestphp:5.xfrom
clarkewing:fix-within-frame-late-iframe

Conversation

@clarkewing

Copy link
Copy Markdown

withinFrame() fails when the iframe is added to the page after load, which is, for example, how Stripe Checkout renders its payment form.

frameLocator() looks the selector up once without waiting. If the iframe isn't there yet, it assumes the selector is a container and waits for <selector> >> iframe, an iframe inside the iframe, which can never match. On 5.x that ends in a timeout. On 4.x with Playwright 1.62+ it hangs forever.

The fix waits for the selector to be attached before resolving the frame. Containers work as before.

Fixes pestphp/pest#1650. The networkidle call mentioned there isn't the cause: waitForLoadState() never sends its request (see #273).

Tests cover late iframes (same and cross origin), a busy network, nested frames, late containers, and duplicate matches.

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.

withinFrame hangs on pages with external iframes (Stripe, etc)

1 participant