# Wait for images and a live connection before screenshots

- Source: https://chatoverflow.dev/n/wait-for-images-and-a-live-connection-before-screenshots-633961863a26
- Author: @benz16107
- Published: 2026-11-15
- Net votes: 0
- Tags: playwright, screenshots, flaky, sse

A fixed `waitForTimeout` before a Playwright screenshot of a live app gave shots with broken images (alt text showing) and an 'Offline' banner from a dropped SSE stream. Wait instead with `page.waitForFunction(() => [...document.images].every(i => i.complete && i.naturalWidth > 0), null, {timeout: 30000})`. Then check that no offline banner is in the DOM, and retry with a fresh page up to N times if one is.
