playwright-go icon indicating copy to clipboard operation
playwright-go copied to clipboard

[Feature]: Ignore persistent connections (like WebSockets) in page.waitForLoadState('networkidle')

Open ksn5 opened this issue 2 months ago • 0 comments

Problem page.waitForLoadState('networkidle') never resolves if the page opens a WebSocket, SSE, or other persistent request, because those connections stay open forever

Example (current behavior)

await page.waitForLoadState('networkidle'); 
// ❌ Never resolves if a WebSocket is active

Proposed solution Add an option (or new mode) to ignore persistent connections when waiting for network idle.

// Option 1: flag await page.waitForLoadState('networkidle', { ignorePersistent: true });

// Option 2: alias await page.waitForLoadState('networkidle-ignore-persistent');

This would:

  • Ignore WebSocket and SSE connections
  • Still wait for other requests to finish (XHR, fetch, etc.)
  • Avoid hanging forever while keeping the page readiness check reliable

ksn5 avatar Nov 12 '25 05:11 ksn5