You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug]: Remote browser close should reject pending waiters before disconnect events #3097
Start a pending waiter, for example page.wait_for_event("download").
Close the remote browser or stop the remote server.
This is already called out in the Python source with a TODO that points to the upstream Playwright fix: microsoft/playwright@d8d5289
Expected behavior
Pending page/context API waiters should reject before browser.close() returns or before the browser disconnected event is emitted.
Actual behavior
Python still has the old remote-close ordering path in playwright/_impl/_browser_type.py. It closes page/context/browser objects synchronously and only then cleans up the connection.
Additional context
This is a small backport/parity fix. The upstream tests are:
should reject waitForEvent before browser.close finishes
should reject waitForEvent before browser.onDisconnect fires
Potential fix direction
Port the upstream ordering change to Python: clean up/reject the remote connection first, then schedule page/context/browser close notifications on the next event-loop turn. Add focused async tests for both close and remote-server-disconnect paths.
Activity
rohan-patnaik commentedon Jun 9, 2026
Opened PR #3099 to address this. let me know if any changes needed there.