Menu

Four things that break when you screenshot websites in production
📰

Four things that break when you screenshot websites in production

DEV Community: node·Dennis·9 days ago
#pVrobbFh
#devtonodejs#devto#dev#every#wait
Reading 0:00
15s threshold

Every team that needs website screenshots eventually writes the same code: spin up headless Chrome, wait for the page, take a picture, hope it looks right. It works in development. In production it becomes one of the most annoying pieces of infrastructure you own.

Here is what actually breaks, and what I ended up doing about it.

1. The page is never ready when you think it is

waitUntil: 'networkidle' is a guess. Single page apps fetch data after the first paint, images load lazily as they scroll into view, and fonts swap a second later. You get a screenshot of a skeleton loader.

What works better is a combination: wait for network idle, then wait for a specific selector, then wait a fixed extra beat for fonts and images inside the viewport. Chromium also exposes Page.captureScreenshot with captureBeyondViewport , which avoids scrolling tricks that trigger more lazy loading.

2. Cookie banners ruin half the captures

Every second site shows a consent wall.…

Continue reading — create a free account

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