October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsSlow PC?RecommendedPC slow today? Run a repair scan before it gets worseResolve common Windows issues and optimize system performance.Scan NowOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
Chrome Headless

How to Show Scrollbars in Chrome Headless Puppeteer Screenshots

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

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

To show a scrollbar in a Chrome headless Puppeteer screenshot, style the element that actually scrolls before calling page.screenshot(). Use standard scrollbar-color and scrollbar-width in Chrome 121 or newer, or the legacy ::-webkit-scrollbar selectors for compatible Chrome builds. This controls appearance; it does not guarantee that an idle overlay scrollbar will remain visible in every operating-system and headless configuration.

Use CSS before taking the screenshot

Puppeteer captures the rendered page. It does not provide a screenshot option that turns a scrollbar on. Add scrollbar CSS after navigation and before the capture, then target the element that owns scrolling.

Style the document scrollbar

html {
  scrollbar-color: #666 #eee;
  scrollbar-width: auto;
}

scrollbar-color sets thumb and track colors. scrollbar-width: auto keeps the browser’s normal width; use thin when a narrower bar is intentional. Chrome for Developers documents these standardized properties as supported starting with Chrome 121: Chrome scrollbar styling.

Use WebKit selectors when you need the legacy route

html::-webkit-scrollbar {
  width: 12px;
}

html::-webkit-scrollbar-thumb {
  background: #666;
}

html::-webkit-scrollbar-track {
  background: #eee;
}

Setting a width or height on ::-webkit-scrollbar can make an overlay scrollbar render more like a classic scrollbar. Keep the rule on the real scroll owner: if a panel, modal, or code viewer scrolls instead of the document, replace html with that element’s selector.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
Sale
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

A complete Puppeteer example

The following script launches regular headless Chrome, loads a page, injects both standards-based and legacy rules, verifies that the document has overflow, and writes a viewport screenshot. The second capture demonstrates a full-page artifact.

const puppeteer = require('puppeteer');

(async () => {
  const browser = await puppeteer.launch({
    headless: true
  });

  try {
    const page = await browser.newPage();
    await page.setViewport({ width: 1440, height: 900, deviceScaleFactor: 1 });
    await page.goto('https://example.com', { waitUntil: 'networkidle2', timeout: 90000 });

    await page.addStyleTag({
      content: `
        html {
          scrollbar-color: #666 #eee;
          scrollbar-width: auto;
        }
        html::-webkit-scrollbar {
          width: 12px;
          height: 12px;
        }
        html::-webkit-scrollbar-thumb {
          background: #666;
        }
        html::-webkit-scrollbar-track {
          background: #eee;
        }
      `
    });

    const metrics = await page.evaluate(() => ({
      scrollHeight: document.documentElement.scrollHeight,
      clientHeight: document.documentElement.clientHeight,
      scrollWidth: document.documentElement.scrollWidth,
      clientWidth: document.documentElement.clientWidth
    }));

    if (metrics.scrollHeight <= metrics.clientHeight &&
        metrics.scrollWidth <= metrics.clientWidth) {
      throw new Error('The document has no overflow, so no scrollbar can be rendered.');
    }

    await page.screenshot({ path: 'viewport.png' });
    await page.screenshot({ path: 'full-page.png', fullPage: true });
  } finally {
    await browser.close();
  }
})();

Replace https://example.com with the page you control or are authorized to capture. waitUntil: 'networkidle2' is a loading policy, not a scrollbar setting; pages with persistent analytics connections may never become truly idle, so use a selector wait or a bounded delay when appropriate.

Make sure you are styling the scroll owner

Document scrolling

When the browser window scrolls, the scroll owner is normally html (and, depending on the page’s CSS, the root body). Inspect the page in an evaluation call:

const root = await page.evaluate(() => ({
  htmlOverflowY: getComputedStyle(document.documentElement).overflowY,
  bodyOverflowY: getComputedStyle(document.body).overflowY,
  documentHeight: document.documentElement.scrollHeight,
  viewportHeight: window.innerHeight
}));
console.log(root);

A document needs content beyond its scrollable height. If a global rule sets html, body { overflow: hidden; }, remove or override it for the capture, or style the component that was deliberately made scrollable.

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

Nested containers

For a layout such as <main class="results"> with overflow-y: auto, apply the rules to .results:

.results {
  overflow-y: auto;
  scrollbar-color: #666 #eee;
  scrollbar-width: auto;
}

.results::-webkit-scrollbar {
  width: 12px;
}

.results::-webkit-scrollbar-thumb {
  background: #666;
}

.results::-webkit-scrollbar-track {
  background: #eee;
}

Confirm the container’s dimensions and overflow in the page context:

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
const panel = await page.evaluate(() => {
  const el = document.querySelector('.results');
  if (!el) return null;
  return {
    scrollHeight: el.scrollHeight,
    clientHeight: el.clientHeight,
    overflowY: getComputedStyle(el).overflowY
  };
});
console.log(panel);

If scrollHeight is not greater than clientHeight, there is no vertical overflow and a vertical scrollbar has nothing to represent.

Overlay versus classic scrollbars

Chrome can render classic scrollbars in a reserved gutter or overlay scrollbars that float over content. Overlay bars may be hidden while idle and appear only during scrolling. Consequently, correct colors and width can still produce an image with no visible bar when the capture occurs before the bar becomes active. Classic bars occupy layout space; overlay bars do not. Chrome’s guidance explains the distinction and the effect of sizing ::-webkit-scrollbar: scrollbar styling documentation.

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

Activate an overlay scrollbar before capture

If your target environment only paints the bar while scrolling, scroll the relevant element and capture immediately. This can help, but it is environment-dependent and should be validated with the same operating system and Chrome build used in production.

await page.evaluate(() => {
  window.scrollTo({ top: 1, behavior: 'instant' });
});
await page.screenshot({ path: 'after-scroll.png' });

For a nested panel:

await page.$eval('.results', el => {
  el.scrollTop = Math.min(1, el.scrollHeight - el.clientHeight);
});
await page.screenshot({ path: 'panel-after-scroll.png' });

Do not treat this as a universal forcing switch. Desktop settings, virtual machines, remote sessions, and headless implementations can choose different scrollbar compositing behavior.

Screenshot extent is separate from scrollbar appearance

Puppeteer’s screenshot options determine which pixels are captured, not whether CSS scrollbars are drawn. The documented fullPage option captures the full page; captureBeyondViewport controls capture outside the current viewport. Neither replaces scrollbar CSS. See the Puppeteer screenshots guide and ScreenshotOptions interface.

Viewport capture

await page.screenshot({
  path: 'viewport.png',
  fullPage: false
});

This captures the visible viewport. A scrollbar can appear at its edge if the scroll owner is scrollable and the selected Chrome environment paints it.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #3
Sale
Dell 24 Monitor - SE2426H - 23.8-inch FHD (1920x1080) 144Hz 1ms Display, in-Plane Switching (IPS) Technology, AMD FreeSync™, TÜV 3-Star 2X HDMI, Tilt
  • Clear visuals. Fluid motion: A 144Hz refresh rate and 1ms MPRT deliver smooth, tear‑free motion across work, gaming, and streaming for clearer, more fluid viewing.
  • Eye comfort: TÜV Rheinland 3‑star* certification reduces harmful blue light while preserving stunning color quality without compromise. *TÜV Rheinland 3-star eye comfort certification.
  • Wide viewing angle: Get consistent views across a wide 178° /178° viewing angle.
  • In-Plane Switching (IPS): See excellent color accuracy and consistency across wide viewing angles with In-plane Switching (IPS) technology.
  • Ultra-thin bezels: Maximize your viewing experience with thin bezels.

Full-page capture

await page.screenshot({
  path: 'full-page.png',
  fullPage: true
});

A full-page screenshot expands the captured height. It is useful for documenting all content, but the resulting image may not show a persistent vertical scrollbar in the way a viewport screenshot does. The scrollbar is a viewport or container UI element; it is not a repeated strip alongside every full-page section.

Headless mode and browser version matter

Puppeteer currently documents version 25.12.0 alongside Chrome for Testing 154.0.8037.57 on its supported-browsers page. That mapping does not mean your installation uses those exact versions; check the version installed in your project and test with the same build in production: supported browsers.

Puppeteer’s headless documentation distinguishes regular headless Chrome from chrome-headless-shell. The shell does not completely match regular Chrome behavior, so a scrollbar that appears in one mode may be idle-hidden or composited differently in the other. Compare with a visible browser when isolating a rendering issue:

const browser = await puppeteer.launch({ headless: false });

Use this only as a diagnostic comparison. Your final screenshot must be generated with the headless mode, operating system, flags, viewport, and browser build that your service actually uses. Read the headless modes guide for the current mode distinctions.

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

A reliable diagnostic checklist

  1. Prove that content overflows. Compare scrollHeight with clientHeight for the document or target container.
  2. Find the scroll owner. Inspect overflow-y, scroll positions, and layout dimensions. Apply CSS to that element, not automatically to body.
  3. Inject before capture. Add the style after navigation and after any application code that might replace the document’s styles.
  4. Check the active Chrome build. Log the Puppeteer package version and browser version; standard properties require Chrome 121 or newer according to Chrome’s documentation.
  5. Test both scrollbar implementations. Keep the standards rules and WebKit rules when your supported Chrome range includes older builds.
  6. Distinguish idle overlay behavior. Scroll by a small amount, capture immediately, and compare with a classic-width rule.
  7. Compare headless modes. Run a visible-browser diagnostic and compare regular headless Chrome with any headless-shell configuration.
  8. Separate geometry from styling. Change fullPage or captureBeyondViewport only when the captured extent is wrong; do not expect those options to create a bar.

Common failures and fixes

The page has no scrollbar at all

Cause: The content fits the viewport, a responsive breakpoint shortened the page, or overflow is disabled. Fix: inspect dimensions and computed overflow. A CSS rule cannot display a scrollbar for content that does not scroll.

Rules are present but the wrong element scrolls

Cause: A nested element has overflow: auto while the rules target html. Fix: move the rules to the nested element and verify its scrollHeight and clientHeight.

Rank #4
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 bar appears in headed mode but not headless

Cause: Overlay compositing, operating-system scrollbar preferences, a different Chrome build, or headless-shell differences. Fix: compare the exact browser versions and modes, then test an explicit width with the WebKit selectors. Do not assume headed output predicts production headless output.

The full-page image is correct but has no vertical bar

Cause: fullPage: true captures expanded content rather than a normal viewport interaction. Fix: capture a viewport image when the visible scrollbar itself is the requirement; use a full-page image separately for complete content.

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

Colors do not change

Cause: The rule is injected before navigation and replaced, has insufficient specificity, or targets the wrong scroll owner. Fix: inject after navigation, inspect computed styles, and target the actual element. For older Chrome support, include the ::-webkit-scrollbar declarations.

The screenshot hangs while waiting for idle

Cause: Long-lived network connections prevent the chosen idle condition. Fix: wait for a stable selector, use a bounded delay, or choose a less restrictive navigation condition while keeping an explicit timeout.

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 provides a website screenshot API and MCP server when you need a rendered image without maintaining Puppeteer and Chrome setup. Its clean-shot pipeline accepts cookie and consent banners before capture and removes 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 each response identifies the result with X-Page-Verdict and X-Billed headers. Its MCP tools—take_screenshot, get_page_info, and capture_pdf—work with Claude, Cursor, and other MCP clients.

For a one-call image request, see the ScreenshotNeo API documentation:

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.
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
import requests
r = requests.get("https://api.screenshotneo.com/v1/shot", params={"access_key": "YOUR_API_KEY", "url": "https://stripe.com"}, timeout=90)
open("shot.webp", "wb").write(r.content)
const q = new URLSearchParams({ access_key: 'YOUR_API_KEY', url: 'https://stripe.com' });
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);

ScreenshotNeo also exposes full-page capture with lazy images loaded, CSS-selector element capture, dark mode, device presets and custom viewports, retina scale, PDF controls, custom CSS and JavaScript, pre-capture clicks, selector hiding, selector or network-idle waits, request and resource blocking, custom headers and cookies, user-agent and authorization values, timezone and geolocation, transparent backgrounds, resizing, chosen cache TTLs, signed image links, asynchronous jobs with signed webhooks, bulk capture for up to 100 URLs per call, a usage API, and an OpenAPI specification. Parameters used by other screenshot APIs also work, which can simplify migration.

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.

The Free plan includes 1,000 screenshots per month with no card. Paid plans start at $5 for 3,000 screenshots; every feature is included on every plan. Create a free ScreenshotNeo account to try it without a card.

FAQ

Does a scrollbar improve accessibility in a screenshot?

A screenshot is a static artifact and cannot provide scrolling or keyboard interaction. Treat visible scrollbar styling as visual documentation; preserve semantic structure and keyboard-accessible scrolling in the live page.

Can I guarantee identical scrollbar pixels across operating systems?

No. Chrome’s overlay or classic choice and the host operating system can change visibility and layout. Pin the browser build and rendering environment, then validate representative captures rather than assuming CSS alone guarantees identical pixels.

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

Should I use a full-page image or a viewport image for a scrollbar bug report?

Use a viewport image to demonstrate the visible scrollbar state, and add a full-page image when the issue also concerns content extent. They answer different capture questions.

Frequently Asked Questions

Does a scrollbar improve accessibility in a screenshot?

A screenshot is a static artifact and cannot provide scrolling or keyboard interaction. Treat visible scrollbar styling as visual documentation; preserve semantic structure and keyboard-accessible scrolling in the live page.

Can I guarantee identical scrollbar pixels across operating systems?

No. Chrome’s overlay or classic choice and the host operating system can change visibility and layout. Pin the browser build and rendering environment, then validate representative captures rather than assuming CSS alone guarantees identical pixels.

Should I use a full-page image or a viewport image for a scrollbar bug report?

Use a viewport image to demonstrate the visible scrollbar state, and add a full-page image when the issue also concerns content extent. They answer different capture questions.

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

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.

Read next

Recommended PC Tool
Recommended PC Tool
Outdated Drivers Are Slowing You DownFree scan - exact matches
Windows Errors? Fix Them Before They SpreadFree repair 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.