A full-page screenshot in Puppeteer is one option: fullPage: true on page.screenshot(). Install Puppeteer, which downloads a matching Chrome, and save this as screenshot.mjs:
Run node screenshot.mjs https://example.com. The image is as wide as the viewport and as tall as the whole document: a test page with twelve 600-pixel sections came out 1280 by 7291 pixels. The try/finally matters once this runs inside a server or a queue worker, where a capture that throws before browser.close() would otherwise leave a Chrome process behind.
Every script here was run with Puppeteer 25.18 against live pages and a small test site built to reproduce the problems below.
Images missing from the bottom of the page
The first full-page screenshot of a real page usually has gaps: empty boxes where images should be, sometimes all of them. Pages load images as they scroll into view, either with loading="lazy" or with a script watching the scroll position, and a full-page screenshot does not scroll. On a test page with 12 lazy-loaded images, seven runs of the script above captured the three nearest the top once and no images at all the other six times. What you get without scrolling depends on timing, which is its own problem.
The fix is to scroll through the page before taking the shot, then wait for the images that scrolling started:
That captured all 12 images, and still did when each image took 1.5 seconds to arrive. Both halves are needed: scrolling makes the page request the images, and the second function waits for exactly those downloads, so it is not held up by unrelated requests such as analytics, and it does not return while an image is still in flight.
The 250 millisecond pause gives scroll-triggered code a chance to run. Raise it for pages that animate content in as you scroll; lower it for long pages where speed matters more.
Sharper images
Puppeteer captures at one image pixel per CSS pixel unless told otherwise. For a capture that stays crisp on a high-density screen, set a device scale factor:
That doubles both dimensions, so a 1280 by 800 viewport becomes a 2560 by 1600 image, four times the pixels, and a full-page capture grows the same way.
PNG, JPEG or WebP
Puppeteer also writes JPEG and WebP: page.screenshot({ type: "webp", quality: 80 }). Switching to JPEG is the usual advice for long pages, but it does not always pay. Full-page captures of four pages at Puppeteer's default scale, with JPEG and WebP at quality 80:
| Page | PNG | JPEG | WebP |
|---|---|---|---|
| Wikipedia, Web scraping (10,596 px tall) | 1,385 KB | 2,088 KB | 1,486 KB |
| Wikipedia, Example.com | 358 KB | 454 KB | 307 KB |
| MDN, 429 Too Many Requests | 428 KB | 326 KB | 199 KB |
| Wikimedia Commons main page, mostly photos | 701 KB | 464 KB | 309 KB |
WebP was the smallest on three of the four; on the long, text-heavy article PNG was, and JPEG was larger than PNG on both Wikipedia pages. Text and flat colour compress well losslessly, so measure your own pages before switching.
One element instead of the page
To capture a chart, a pricing table or a single card, take the screenshot from the element:
waitForSelector returns the element once it is visible, and the image is cropped to its box.
Still blank, or missing content?
If the screenshot is empty rather than missing images, the page usually was not finished when the screenshot was taken: content fetched after load, a fade-in animation, or a web font still downloading. networkidle2 in particular lets two requests stay open, so it can fire while the request that carries the page's content is still in flight. Five causes of a blank Puppeteer screenshot covers each one with a measured fix.
Without running Chrome
The domscout screenshot API runs the capture on its own Chromium. Set lazyScroll and it scrolls the page in viewport-sized steps, up to 20 of them, before capturing:
It costs 2 credits: 1 for the capture and 1 for fullPage, which also covers lazyScroll. Full-page capture needs the Pro plan or above, and a page taller than 12,000 pixels is refused with 400 CAPTURE_TOO_TALL rather than cut off silently. A full-page capture with lazyScroll is the heaviest kind of request; if one answers 504, send it again with "async": true and collect it as a job. Try a single page first with the free screenshot tool, no account needed.
Next steps
- The screenshot API guide covers viewports, devices, element capture and PDFs.
- Working in Python? Screenshot a website with Python does the same with Playwright.
- The screenshot API overview lists formats and plans, and the API documentation every field and error code.