Hardware FixRecommendedDevice not working? Your driver may be the problemCheck updates for common hardware issues.Fix DriversOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsClean PCRecommendedOne scan can reveal what keeps slowing WindowsLook for cleanup and repair opportunities.Run Scan×
Skip to content
World desk6 min

How to Capture a Website Screenshot After Scrolling Nested Containers

Playwright full-page screenshots target the document, not necessarily the content hidden inside nested scroll areas. Learn to identify, scroll, and capture each container in overlapping segments.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

To capture content inside a nested scroll area, scroll that container to the content you need, wait for it to load, then take a screenshot of the visible element or viewport. Repeat at overlapping scroll positions to record the entire area. Playwright’s page-level fullPage option captures the document’s scrollable page; it should not be assumed to expand every inner overflow: auto container.

Why a full-page screenshot may miss nested content

A page can have more than one scrolling surface: the document, an outer panel, and an inner panel. A page-level full-page screenshot targets the document. A screenshot of an element is cropped to that element’s bounds; when the element is scrollable, Playwright documents that only the content currently scrolled into view appears. Its element screenshot scrolls the element into view, but does not reveal the element’s entire internal scroll range.

As an Amazon Associate I earn from qualifying purchases.

That distinction determines the workflow: identify the element whose scroll position changes, scroll it deliberately, and capture successive visible states. Playwright’s Screenshots guide and ElementHandle API describe these behaviors.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Choose the capture method for your goal

Goal Method What to expect
Capture a normally scrolling document page.screenshot({ fullPage: true }) Captures the full scrollable page as documented by Playwright.
Capture the currently visible part of a nested panel Scroll the panel, then take a locator or element screenshot Shows the element’s current visible content within its bounds, not its entire overflow range.
Record all content in a long nested panel Capture overlapping positions and stitch the images, or expand the panel if the application layout permits Produces a sequence or composite; these are practical workarounds, not a universal one-call Playwright feature.

Capture a nested container with Playwright

The example below uses Node.js, Playwright, and a CSS selector for the inner scrolling element. Replace the URL and selector, and adjust the site-specific wait condition to match how the page signals that new content has loaded.

#1 Best Overall
Philips 24 Inch Computer Monitor FHD 100Hz VA VESA Flicker-Free, 241V8LB
  • CRISP CLARITY: This 23.8″ Philips V line monitor delivers crisp Full HD 1920x1080 visuals. Enjoy movies, shows and videos with remarkable detail
  • INCREDIBLE CONTRAST: The VA panel produces brighter whites and deeper blacks. You get true-to-life images and more gradients with 16.7 million colors
  • THE PERFECT VIEW: The 178/178 degree extra wide viewing angle prevents the shifting of colors when viewed from an offset angle, so you always get consistent colors
  • WORK SEAMLESSLY: This sleek monitor is virtually bezel-free on three sides, so the screen looks even bigger for the viewer. This minimalistic design also allows for seamless multi-monitor setups that enhance your workflow and boost productivity
  • A BETTER READING EXPERIENCE: For busy office workers, EasyRead mode provides a more paper-like experience for when viewing lengthy documents

Install Playwright

  1. Create a project and install the package: npm init -y, then npm install playwright.

  2. Install a browser if your environment does not already have one: npx playwright install chromium.

Capture the visible content after scrolling

Save this as capture.mjs and run it with node capture.mjs. The script scrolls in overlapping steps, waits briefly after each move, and saves a screenshot of the panel at each position. The overlap makes later stitching less likely to leave gaps.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
import { chromium } from 'playwright';

const url = 'https://example.com';
const containerSelector = '.scrollable-panel';
const overlap = 120;

const browser = await chromium.launch({ headless: true });
const page = await browser.newPage({ viewport: { width: 1440, height: 1000 } });

try {
  await page.goto(url, { waitUntil: 'domcontentloaded', timeout: 30000 });
  const panel = page.locator(containerSelector);
  await panel.waitFor({ state: 'visible', timeout: 15000 });

  const dimensions = await panel.evaluate((el) => ({
    scrollHeight: el.scrollHeight,
    clientHeight: el.clientHeight,
    scrollTop: el.scrollTop,
  }));
  console.log('Panel dimensions:', dimensions);

  const step = Math.max(1, dimensions.clientHeight - overlap);
  let position = 0;
  let index = 0;

  while (true) {
    await panel.evaluate((el, top) => { el.scrollTop = top; }, position);
    // Replace with an application-specific readiness check if content loads asynchronously.
    await page.waitForTimeout(300);
    await panel.screenshot({ path: `panel-${String(index).padStart(3, '0')}.png` });

    const state = await panel.evaluate((el) => ({
      scrollTop: el.scrollTop,
      scrollHeight: el.scrollHeight,
      clientHeight: el.clientHeight,
    }));
    const next = Math.min(state.scrollTop + step, state.scrollHeight - state.clientHeight);
    if (next <= state.scrollTop) break;
    position = next;
    index += 1;
  }
} finally {
  await browser.close();
}

The output is one PNG per position. This code does not stitch them into a single image; use an image-processing step if one tall artifact is required. When scroll-triggered loading increases scrollHeight, the loop reads the updated value at each iteration. A site-specific wait is still important: a fixed delay cannot guarantee that network-loaded content has finished rendering.

Rank #2
Philips 22 Inch Computer Monitor FHD 100Hz VA VESA Flicker-Free, 221V8LB
  • CRISP CLARITY: This 22 inch class (21.5″ viewable) Philips V line monitor delivers crisp Full HD 1920x1080 visuals. Enjoy movies, shows and videos with remarkable detail
  • 100HZ FAST REFRESH RATE: 100Hz brings your favorite movies and video games to life. Stream, binge, and play effortlessly
  • SMOOTH ACTION WITH ADAPTIVE-SYNC: Adaptive-Sync technology ensures fluid action sequences and rapid response time. Every frame will be rendered smoothly with crystal clarity and without stutter
  • INCREDIBLE CONTRAST: The VA panel produces brighter whites and deeper blacks. You get true-to-life images and more gradients with 16.7 million colors
  • THE PERFECT VIEW: The 178/178 degree extra wide viewing angle prevents the shifting of colors when viewed from an offset angle, so you always get consistent colors

Inspect nested scroll areas

If the outer panel must move before the inner panel is reachable, identify and scroll the outer element first, then repeat the measurements and capture steps for the inner one. This helper lists elements that currently have more scrollable height than visible height; run it after the page renders.

const candidates = await page.locator('body *').evaluateAll((els) =>
  els
    .filter((el) => el.scrollHeight > el.clientHeight + 1)
    .map((el) => ({
      tag: el.tagName.toLowerCase(),
      id: el.id,
      className: typeof el.className === 'string' ? el.className : '',
      scrollHeight: el.scrollHeight,
      clientHeight: el.clientHeight,
    }))
);
console.log(candidates);

This is a discovery aid, not proof that every listed element is the target: pages can contain unrelated scrollable widgets. Confirm the candidate by inspecting the page and observing which element’s scrollTop changes when you interact with the desired area.

Make captures complete and usable

Scroll incrementally for lazy-loaded content

Some interfaces fetch or render content only as it approaches the visible area. Traverse the panel in steps rather than jumping straight to the bottom, and wait for a meaningful application signal after each move—for example, a known loading indicator to disappear or a newly loaded item to appear. A fixed pause is simple but can be too short on a slow page and waste time on a fast one.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Prevent seams and misleading captures

When to expand the container

If you control the page and its layout allows it, temporarily increasing the container’s height or removing its overflow restriction can expose more content in one capture. This can alter layout, trigger different lazy-loading behavior, or change sticky positioning, so compare the expanded result with the original interface. For pages you do not control, overlapping captures are generally easier to validate.

Troubleshooting

  • The screenshot contains only the first visible slice. The screenshot is showing the element’s current scroll position. Scroll the target element before capturing; an element screenshot does not automatically include its full overflow content.

  • fullPage: true does not reveal a panel’s hidden content. That option targets the full document page. Identify the panel that actually scrolls and capture it at successive positions.

    Rank #4
    Sale
    Samsung 27" Essential S3 (S36GD) Series FHD 1800R Curved Computer Monitor
    • CURVED FOR ENHANCED ENGAGEMENT: An immersive viewing experience with a curved monitor that wraps more closely around your field of vision; It creates a wider view, enhancing depth perception and minimizing peripheral distraction
    • SMOOTH PERFORMANCE FOR SEAMLESS CONTENT: Stay in the action when playing games, watching videos, or working on creative projects; The 100Hz refresh rate reduces lag and motion blur so you don't miss a thing in fast-paced moments¹
    • MORE GAMING POWER: Gain the edge with optimizable game settings; Color and image contrast can be adjusted to see scenes more vividly and spot enemies hiding in the dark; Game Mode adjusts any game to fill the screen so you can view every detail²
    • KEEP IT EASY ON THE EYES: Care for your eyes and stay comfortable, even during long sessions; Advanced eye comfort technology certified by TÜV reduces eye strain by minimizing blue light and reducing irritating screen flicker²
    • INCREASED VERSATILITY: Connect to more; Plug devices straight into your monitor for increased flexibility, making your computing environment even more convenient
  • The selector times out or matches the wrong panel. Confirm the selector against the rendered page, wait for the element to become visible, and distinguish nested matches with a more specific selector or locator scope.

    Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  • Later captures are blank or repeat earlier content. Check that the intended element’s scrollTop changes. If the site loads on scroll, traverse gradually and wait for its content-ready signal before taking each screenshot.

  • The final section is missing. Re-read scrollHeight after scrolling because loading may extend the panel. Stop only when the actual scroll position reaches the current maximum, rather than assuming the original dimensions remain fixed.

  • Stitched output has duplicated headers or gaps. Increase overlap and account for sticky or fixed elements. If the header is fixed within the panel, remove or mask its repeated copies during composition.

  • Full-page behavior differs across browser engines or versions. A historical Playwright issue about non-body scrolling content is a diagnostic clue, not proof that all current versions and engines behave alike. Check the current API documentation and validate the exact browser and layout you use.

    Free tools Windows power users keep installed

    One-click scans. No signup required.

    Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
    Best Value
    Sale
    Sceptre New 22-Inch Gaming Monitor, FHD 1080p, Up to 144Hz, HDMI, DisplayPort, Built-in Speakers, Machine Black (E225W-FW144 Series, 2026)
    • 【INTEGRATED SPEAKERS】Whether you're at work or in the midst of an intense gaming session, our built-in speakers provide rich and seamless audio, all while keeping your desk clutter-free.
    • 【EASY ON THE EYES】 Protect your eyes and enhance your comfort with Blue-Light Shift technology. This feature reduces harmful blue light emissions from your screen, helping to alleviate eye strain during long hours of use and promoting healthier viewing habits.
    • 【WIDEN YOUR PERSPECTIVE】Our sleek minimal bezel design ensures undivided attention. The nearly bezel-free display seamlessly connects in a dual monitor arrangement, delivering an unobstructed view that lets you focus on more at once, completely distraction-free.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Or skip the browser setup

ScreenshotNeo is a website screenshot API and MCP server. Its one-request API can return a screenshot or PDF, but a screenshot service cannot be assumed to reproduce a custom sequence of scroll positions through an arbitrary nested panel. For the documented API options and response behavior, see the ScreenshotNeo documentation.

curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://example.com -o shot.webp

Before capture, ScreenshotNeo can accept cookie and consent banners and remove more than 60 known consent platforms, newsletter popups, and chat widgets; each step can be turned off. Bot checks and CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed, and response headers identify the page verdict and billing status. Its MCP server provides take_screenshot, get_page_info, and capture_pdf for AI agents. The Free plan includes 1,000 shots a month with no card; paid plans start at $5 for 3,000 shots.

Sign up free for 1,000 screenshots a month, with no card required.

Frequently Asked Questions

Does a Playwright element screenshot scroll the target into view?

Yes. It scrolls the element into view before capture, but does not expose all of a scrollable element’s internal content at once.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Can I save every nested-container segment as one tall image with Playwright?

The capture loop creates separate image files. Stitch overlapping captures with an image-processing step if you need one composite; that is a workaround rather than a universal one-call nested-container screenshot option.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Windows Errors? Fix Them Before They SpreadFree repair scan
Crashes, No Sound, or Screen Glitches?Free driver scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.