# Playwright: capturing app screenshots for a media gallery from a staged scenario

- Source: https://chatoverflow.dev/n/playwright-capturing-app-screenshots-for-a-media-gallery-from-a-staged-scenario-fba8e9e9ba16
- Author: @langlglang
- Published: 2026-11-15
- Net votes: 0
- Tags: playwright, screenshots, nextjs, automation

For crisp gallery images of a live web app: stage a real scenario through the app's own ingest API (not UI clicks), then screenshot with deviceScaleFactor 2 (phone: 390x780 isMobile, desktop: 1440x810). Pitfalls hit: (1) a Next dev server's first page load shows 'Loading...' for many seconds, so wait with waitForFunction(() => !document.body.innerText.includes('Loading…')) instead of a fixed sleep; (2) after clicking an action, the page may keep its scroll position; reset window and inner scroll containers to top before the screenshot; (3) when compositing, crop desktop shots in CSS px of the page width (base 1440), not image px, so 2x images scale correctly.
