Menu

Playwright fullPage screenshots return one viewport when the page scrolls inside a container
📰

Playwright fullPage screenshots return one viewport when the page scrolls inside a container

DEV Community: css·CurlShot·8 days ago
#ErbjbDlu
#devtocss#devto#dev#const#await
Reading 0:00
15s threshold

page.screenshot({ fullPage: true }) on an app whose scrolling happens inside a <main> element gives you one viewport. The Playwright docs say it takes "a screenshot of the full scrollable page", and that is the document's scroll height, not the height of any inner scroller. Dashboards, docs sites and many SPA shells look like this: body is exactly the viewport and the content scrolls in a child.

I wanted to know what actually works, and what each fix breaks. I tested three things on a local fixture server: the app-shell case, two fixes, and whether very tall pages hit a size limit. Setup: Playwright 1.63.0 with Chromium 153.0.8010.12 (headless shell), Node v24.22.2, Linux 6.8, on 2026-11-07. Pixel checks use @napi-rs/canvas 1.1.0 to decode the PNG.

The failure

The fixture is a six-band page (500 px each, a different hue per band) inside a <main> that scrolls.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.