-
-
Notifications
You must be signed in to change notification settings - Fork 455
Description
FYI.- I will try and PR this later in the week. Mansoor did the original WithinFrame, I will discuss with him privately. I've fixed locally with a custom method until I can switch back - Stripe fails locally and in CI without it.
withinFrame calls waitForLoadState('networkidle') before entering the iframe. External iframes like Stripe Payment Element make continuous network requests, so networkidle never resolves and the browser context dies with:
Target page, context or browser has been closed
Fix
In InteractsWithFrames.php, replace networkidle with load:
- $this->page->waitForLoadState('networkidle');
+ $this->page->waitForLoadState('load');The waitFor(['state' => 'attached']) on the next line already ensures the iframe is ready.
Also, frameLocator($selector) double-nests the selector when the target is a container div (not the iframe itself). Simpler:
- $locator = $this->guessLocator($selector)->frameLocator($selector);
+ $locator = $this->guessLocator($selector)->locator('iframe');Workaround
We're using a helper that replicates withinFrame without the networkidle wait until this is fixed upstream.
pest-plugin-browser v4.1.1, macOS, Chromium headless.