A full-page screenshot in Puppeteer is one option: page.screenshot({ fullPage: true }). It works on simple pages. On modern sites it fails in three ways that give no error: sections that only appear when scrolled into view come out blank, fixed elements such as cookie bars land in the middle of the image, and apps that scroll inside a container give you one screen instead of the page.
This guide shows the basic call, explains how Puppeteer captures beyond the viewport, and then takes each failure in turn with what we measured on 15 real sites and on local test pages, and the code that fixed it. The full script is at the end.
The basic call
Set a viewport, load the page, and pass fullPage: true:
const puppeteer = require('puppeteer');
(async () => {
const browser = await puppeteer.launch();
const page = await browser.newPage();
await page.setViewport({ width: 1280, height: 800 });
await page.goto('https://www.python.org', { waitUntil: 'networkidle2' });
const image = await page.screenshot({ path: 'python-org.png', fullPage: true });
console.log(`${image.length} bytes, ${image.readUInt32BE(16)} × ${image.readUInt32BE(20)} px`);
await browser.close();
})();
Output, run twice on 22 October 2026:
472713 bytes, 1280 × 2632 px
473230 bytes, 1280 × 2632 px
The width is the viewport width. The height is the document's scroll height at the moment of the call, 2,632 px here. Python.org is a plain document that scrolls normally, so this is all it needs.
How Puppeteer captures beyond the viewport
An ordinary screenshot covers only the viewport. To get more, Puppeteer sends the DevTools Protocol command Page.captureScreenshot with captureBeyondViewport: true, which asks Chrome to render the whole document into one image while the page keeps its 1280 × 800 viewport. The protocol marks that flag experimental and defaults it to false.
Puppeteer's documentation says captureBeyondViewport defaults to false when there's no clip. That's true for ordinary screenshots, but not for full-page ones: in the 25.15.0 source, setDefaultScreenshotOptions sets it to true, and it is only switched off for screenshots that are neither full-page nor clipped. If you pass captureBeyondViewport: false yourself with fullPage: true, Puppeteer uses a different method: it resizes the viewport to the document's full scroll height, captures, and resizes it back.
The difference matters, because in the default mode the page still believes its viewport is 800 px tall. Most of what follows comes from that.
How we tested
On 22 October 2026 we loaded 15 home pages with a 1280 × 800 viewport: GitHub, React, MDN, Hacker News, GOV.UK, BBC, Shopify, Linear, Apple, Python.org, Node.js, Spotify's web player, Notion, Vercel and Figma. Each page was captured in a fresh browser context, with both values of captureBeyondViewport, and we recorded the document height at the load event and after the network went quiet. We then captured seven of them twice more, plain and with the fixes below, and timed both. We also built three local test pages: one with a fixed header, a fixed bottom bar, a sticky navigation bar and a hero sized 100vh; one whose content scrolls inside a div; and one that adds its content 1.5 seconds after load.
Problem 1: content that appears only when scrolled into view
Many sites reveal sections as you scroll: they start hidden or empty and an IntersectionObserver fades them in when they enter the viewport. MDN lists exactly this use: "Deciding whether or not to perform tasks or animation processes based on whether or not the user will see the result". An observer's root defaults to the browser viewport. In the default capture mode the viewport is still the first 800 px, so nothing below it ever intersects, and those sections are captured in their hidden state.
GitHub's home page shows it clearly. The plain full-page capture has large empty panels where product sections should be. After scrolling down one screen at a time and back to the top, the same capture has all of them:

The page's height also changes while content arrives. On 7 of the 15 sites, the document height at the load event differed from the height once the network was quiet:
| Site | Height at load | Height after network idle |
|---|
| github.com | 11,099 px | 11,314 px |
| developer.mozilla.org | 2,451 px | 2,851 px |
| bbc.com | 12,586 px | 7,986 px |
| shopify.com | 10,288 px | 10,618 px |
| notion.com | 3,907 px | 4,511 px |
| figma.com | 7,977 px | 8,377 px |
| nodejs.org | 977 px | 1,021 px |
Our local test page showed the extreme case. It renders two blocks, then adds eight more 1.5 seconds later. A capture at load was 808 px tall; two seconds later it was 4,040 px. Puppeteer measures the height when you call screenshot, so the fix is to call it later: wait for the network to go quiet (waitUntil: 'networkidle2' or page.waitForNetworkIdle()), then scroll through the page so scroll-triggered content runs, then go back to the top.
The scroll pass didn't fix every site. On vercel.com the lower sections were empty in both the plain and the scrolled capture. Only the resize method, captureBeyondViewport: false, rendered them, presumably because the whole page is then inside the viewport. That method has its own cost, shown next, so we use it only for sites like this, after checking the result.
Lazy-loaded images are the same problem with a different trigger; we measured those separately in Why full-page screenshots come out with blank images.
Problem 2: fixed elements and 100vh sections
MDN defines a position: fixed element as positioned relative to its initial containing block, "which is the viewport in the case of visual media". In the default capture mode that viewport is the first 800 px of the image. A fixed header therefore appears once, at the top, which is usually what you want. But a fixed bar pinned to the bottom of the screen, such as a cookie notice or a chat button, is drawn at 750 to 800 px, in the middle of the page, on top of whatever is there.
Switching to captureBeyondViewport: false moves the bottom bar to the bottom of the image, but breaks something worse. Puppeteer measures the scroll height first, 4,272 px on our test page, and then resizes the viewport to that height. The hero section, sized height: 100vh, grows from 800 px to 4,272 px, pushes everything else below the edge of the image, and the capture contains nothing but the header, a red hero and the bottom bar. The sticky navigation, eight content blocks and the footer are gone:

The measured layout of the two captures, both 1,280 × 4,272 px:
| Element | Default mode | captureBeyondViewport: false |
|---|
| Fixed header | y = 0 | y = 0 |
| 100vh hero | 740 px visible below the header | 4,162 px visible |
| Fixed bottom bar | y = 750 | y = 4,222 |
| Sticky nav, content, footer | all present, footer at y = 4,072 | not in the image |
Keep the default mode and deal with the fixed elements instead. Our script hides every visible fixed element that isn't a bar pinned to the top edge. Hiding a consent banner doesn't accept or reject anything; our cookie banner article covers the options in more detail. Consent managers often build their banner inside a shadow root, so the script looks inside open shadow roots too. On notion.com that's where the banner was, and a search of the main document alone missed it.
Problem 3: pages that scroll inside a container
Web apps often fix the document to the window's height and scroll an inner element instead, with CSS such as html, body { height: 100%; overflow: hidden } and overflow-y: auto on a main panel. MDN describes such an element as a scroll container whose overflowing content is "clipped at the element's padding box". The document itself never gets taller than the viewport, so fullPage: true has nothing more to capture.
Spotify's web player was the one site of our 15 built this way. Its document height was exactly 800 px, while its main panel held 1,528 px of content. The plain full-page capture was 1,280 × 800 px with a cookie banner over the lower half. Our script found the tallest scrolling element, removed the height limit and the overflow clipping from it and its ancestors, and the capture grew to 1,592 px with the footer included:

The right-hand image also shows the limit of a generic fix. Spotify's purple "Preview of Spotify" bar isn't a fixed element; it's part of the app's own layout, and after the expansion it sits in the middle of the page. For a site you capture often, add a selector for elements like that and hide them yourself.
The full script
Save it as fullpage.js next to an installed puppeteer package. It exports the three steps and a fullPageScreenshot function that runs them in order, and works from the command line with a URL and an output path.
const puppeteer = require('puppeteer');
const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
async function scrollThrough(page, { stepDelay = 250, maxSteps = 60 } = {}) {
for (let step = 0; step < maxSteps; step++) {
const atBottom = await page.evaluate(() => {
window.scrollBy(0, window.innerHeight);
return window.scrollY + window.innerHeight >= document.documentElement.scrollHeight - 2;
});
await sleep(stepDelay);
if (atBottom) break;
}
await page.evaluate(() => window.scrollTo(0, 0));
await sleep(500);
}
async function expandScrollContainer(page) {
return page.evaluate(() => {
const doc = document.documentElement;
if (doc.scrollHeight > window.innerHeight + 10) return null;
let tallest = null;
for (const el of document.querySelectorAll('body *')) {
const { overflowY } = getComputedStyle(el);
if (!/(auto|scroll)/.test(overflowY) || el.scrollHeight <= el.clientHeight + 10) continue;
if (!tallest || el.scrollHeight > tallest.scrollHeight) tallest = el;
}
if (!tallest) return null;
const before = tallest.scrollHeight;
for (let el = tallest; el; el = el.parentElement) {
el.style.setProperty('height', 'auto', 'important');
el.style.setProperty('max-height', 'none', 'important');
el.style.setProperty('overflow', 'visible', 'important');
}
return { element: tallest.tagName.toLowerCase(), scrollHeight: before, pageHeight: doc.scrollHeight };
});
}
async function hideFixedOverlays(page) {
return page.evaluate(() => {
let hidden = 0;
const visit = (root) => {
for (const el of root.querySelectorAll('*')) {
if (el.shadowRoot) visit(el.shadowRoot);
if (getComputedStyle(el).position !== 'fixed') continue;
const box = el.getBoundingClientRect();
if (box.width === 0 || box.height === 0) continue;
if (box.top <= 0 && box.height < window.innerHeight / 2) continue;
el.style.setProperty('display', 'none', 'important');
hidden++;
}
};
visit(document);
return hidden;
});
}
async function fullPageScreenshot(page, path) {
await scrollThrough(page);
const expanded = await expandScrollContainer(page);
const hidden = await hideFixedOverlays(page);
await page.screenshot({ path, fullPage: true });
return { expanded, hidden };
}
module.exports = { scrollThrough, expandScrollContainer, hideFixedOverlays, fullPageScreenshot };
if (require.main === module) {
(async () => {
const [url, path = 'page.png'] = process.argv.slice(2);
const browser = await puppeteer.launch();
const page = await browser.newPage();
await page.setViewport({ width: 1280, height: 800 });
await page.goto(url, { waitUntil: 'networkidle2' });
const { expanded, hidden } = await fullPageScreenshot(page, path);
const height = await page.evaluate(() => document.documentElement.scrollHeight);
console.log(`${path}: ${height}px tall, ${hidden} fixed overlays hidden`);
if (expanded) console.log(`expanded a <${expanded.element}> that scrolled ${expanded.scrollHeight}px`);
await browser.close();
})();
}
Output for Spotify and GitHub, run on 22 October 2026:
$ node fullpage.js https:
out/run-spotify.png: 1592px tall, 1 fixed overlays hidden
expanded a <div> that scrolled 1528px
$ node fullpage.js https:
out/run-github.png: 11573px tall, 2 fixed overlays hidden
What the fixes cost
The scroll pass waits 250 ms per screen and 500 ms at the end, so long pages take longer. Times from starting navigation to having the file, one run each:
| Site | Plain fullPage | With the script | Height, plain | Height, with the script |
|---|
| github.com | 1.7 s | 5.9 s | 11,314 px | 11,573 px |
| vercel.com | 1.6 s | 3.6 s | 5,127 px | 5,670 px |
| notion.com | 1.3 s | 4.8 s | 4,511 px | 4,511 px |
| react.dev | 1.3 s | 4.5 s | 8,857 px | 9,067 px |
| linear.app | 2.3 s | 5.8 s | 9,619 px | 9,619 px |
| bbc.com | 1.7 s | 4.7 s | 7,986 px | 7,883 px |
| open.spotify.com | 1.7 s | 2.5 s | 800 px | 1,592 px |
Up to about four extra seconds per page is the price of a capture closer to what a visitor scrolling the page sees. Lower stepDelay if your pages are light; raise it if reveal animations are slow.
Two more limits
Two other failures come up with full-page captures, and we covered each in its own article. Images with loading="lazy" or data-src stay blank unless the page is scrolled or the images are made eager: see Why full-page screenshots come out with blank images. Very tall pages hit format limits, and Chrome returns an empty WebP above 16,383 device pixels: see The 16,383-pixel WebP limit.
If you'd rather not maintain this, our free screenshot tool and the screenshot API make full-page captures for you.
Checklist
- Set the viewport explicitly; the width decides the layout and the image width.
- Wait for the network to go quiet before you capture.
- Scroll through the page and back to the top so scroll-triggered content renders.
- If the document is no taller than the viewport, expand the element that scrolls.
- Hide fixed elements that aren't pinned to the top.
- Keep the default
captureBeyondViewport: true; use false only for a page you've checked, because 100vh sections will grow to the full height.
- Look at the result. Each of these failures produces a valid image and no error.