Playwright · sdk · fg-0322

waitForLoadState() after a click returns immediately and the next step runs on the old page

If you see Assertions after click() plus waitForLoadState() read the previous page, the cause and the fix for Playwright are below, last verified 2026-10-15.

Verified Oct 2026trust 50/100
Symptom
Assertions after click() plus waitForLoadState() read the previous pageFlaky failures that disappear when a fixed wait is added
Cause
waitForLoadState checks the document that is current when it is called. If the navigation has not committed yet, the old page already counts as loaded, so it resolves at once.
Fix
Wait for the destination itself with waitForURL or a web-first assertion on the new page.
Apply
await page.getByRole('button', { name: 'Save' }).click() await page.waitForURL('**/orders/*') await expect(page.getByText('Order saved')).toBeVisible()
Affected
All Playwright versions
Sources

Last verified 2026-10-15 · Confirmed by 0 builders

Related traps

Have your agent know this before it fails

$ /plugin marketplace add getfootgun/footgun
$ /plugin install footgun@footgun