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

Some links on this page are affiliate links: if you buy through them we may earn a commission, at no extra cost to you.

Use Playwright’s temporary style option to inject scrollbar CSS only while the screenshot is being rendered. Apply both scrollbar-width: none and the WebKit pseudo-element rule, and add fullPage: true when you need the entire document:

await page.screenshot({
  path: 'screenshot.png',
  fullPage: true,
  style: `
    html, body {
      scrollbar-width: none;
    }
    html::-webkit-scrollbar,
    body::-webkit-scrollbar {
      display: none;
    }
  `,
});

The stylesheet exists for the capture only, so your application’s normal CSS and scrolling behavior are unchanged.

Why the screenshot stylesheet is the right place

Playwright’s screenshot API accepts stylesheet text through style. Playwright applies that CSS while it captures the page, including content in Shadow DOM and inner frames. Because the injection is temporary, you do not need test-only classes in production code or a cleanup step after the screenshot.

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

scrollbar-width: none hides the scrollbar while leaving the element scrollable. The ::-webkit-scrollbar pseudo-element covers WebKit/Blink-style implementations that do not consistently honor the standard property. Using both rules gives more predictable results across the browser engines used by Playwright.

#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

For the page-level scrollbar, target both html and body. If the visible bar belongs to an application panel, use that panel’s selector instead. A dashboard might need .results-pane; a page can have several nested scrolling elements, and each one must be styled separately.

Complete Playwright examples

JavaScript with a full-page capture

import { chromium } from 'playwright';

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

await page.goto('https://example.com', { waitUntil: 'networkidle' });

await page.screenshot({
  path: 'page-without-scrollbar.png',
  fullPage: true,
  style: `
    html, body {
      scrollbar-width: none;
    }
    html::-webkit-scrollbar,
    body::-webkit-scrollbar {
      display: none;
    }
  `,
});

await browser.close();

fullPage: true tells Playwright to capture the full scrollable document rather than only the current viewport. Without it, the same stylesheet hides the bar in a viewport screenshot, but content below the fold is not included.

Reusable helper for tests and scripts

const hideScrollbars = `
  html, body {
    scrollbar-width: none;
  }
  html::-webkit-scrollbar,
  body::-webkit-scrollbar {
    display: none;
  }
`;

export async function screenshotWithoutScrollbars(page, path, options = {}) {
  await page.screenshot({
    path,
    fullPage: true,
    style: hideScrollbars,
    ...options,
  });
}

Keep this string in one shared helper so visual tests use identical CSS. If one test injects a slightly different selector or spacing, pixel comparisons can fail for reasons unrelated to the page.

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.

Hiding scrollbars on an inner panel

await page.screenshot({
  path: 'dashboard.png',
  style: `
    .results-pane,
    .results-pane * {
      scrollbar-width: none;
    }
    .results-pane::-webkit-scrollbar {
      display: none;
    }
    .results-pane *::-webkit-scrollbar {
      display: none;
    }
  `,
});

Use the narrowest selector that owns the scrollbar. Styling only html and body cannot remove a bar painted by a nested scrolling element.

Applying the same CSS before an assertion

await expect(page).toHaveScreenshot('home.png', {
  fullPage: true,
  style: `
    html, body {
      scrollbar-width: none;
    }
    html::-webkit-scrollbar,
    body::-webkit-scrollbar {
      display: none;
    }
  `,
});

Use the option supported by your installed Playwright version for screenshot assertions, and keep the injected rules deterministic. The important part is that the assertion and any baseline generation use the same capture state.

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

Hide the bar without disabling scrolling

The two-rule recipe changes scrollbar visibility, not overflow. Users and scripts can still scroll with a wheel, touch gesture, keyboard, focus movement, or JavaScript. This is normally the correct choice for a clean screenshot when the page’s layout and scroll position must remain natural.

Do not copy scrollbar-width: none into permanent product CSS casually. MDN cautions that removing the visible affordance can make content difficult or impossible to discover when no other scrolling mechanism is obvious. A temporary screenshot stylesheet avoids that product-accessibility trade-off.

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

When to use overflow: hidden instead

If the captured state must not scroll, inject:

await page.screenshot({
  path: 'static-state.png',
  style: `html, body { overflow: hidden; }`,
});

overflow: hidden removes visible scrollbars, but it is not equivalent to merely hiding them. Hidden overflow can still be brought into view programmatically or by focus, while content may also be clipped. It can change available layout width and alter how fixed or sticky elements are positioned. Choose it only when those behavior changes are intentional.

Goal CSS to inject Effect
Clean image, normal scrolling scrollbar-width: none plus ::-webkit-scrollbar { display: none; } Scrollbar is not painted; content remains scrollable.
Non-scrollable or deliberately clipped capture html, body { overflow: hidden; } Changes overflow behavior and may clip content or alter layout.
Panel-only cleanup Apply either approach to the panel selector Leaves unrelated page scroll containers alone.

Full-page capture details and browser differences

A full-page screenshot is a capture of the document’s full scrollable page, not a series of manually scrolled viewport images. Playwright may temporarily adjust the page to render that output. The stylesheet is applied during that operation, so target every container that can paint a scrollbar.

Scrollbar painting is environment-dependent. Operating-system settings, browser engine, headed versus headless mode, device scale, and capture mode can all affect whether a bar is visible in the first place. A Windows 11 report involving Playwright 1.50.1 found a full-page screenshot in which the body scrollbar was not painted. Therefore, a visual assertion should not require that a scrollbar exist before your hiding rule runs; assert the intended page appearance instead.

Common problems and fixes

The page scrollbar disappeared, but a panel scrollbar remains

Cause: The panel owns its own overflow and is not affected by html, body.

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.

Fix: Inspect the element with overflow: auto or overflow: scroll, then add its selector and corresponding pseudo-element rule to the temporary stylesheet.

The screenshot still shows a thin scrollbar

Cause: Only one browser-specific rule was supplied, or the bar belongs to a nested element.

Fix: Keep both scrollbar-width: none and ::-webkit-scrollbar { display: none; }; include every scrolling container. Also verify that the selector is not overridden by a later rule inside the page.

The screenshot is clipped after adding overflow: hidden

Cause: Hidden overflow clips content instead of merely changing its decoration.

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

Fix: Return to the visibility-only recipe unless a clipped, non-scrollable state is the actual requirement. If clipping is intentional, size the capture and container explicitly and verify the result at each viewport.

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

A visual test fails on one operating system

Cause: Native scrollbar painting and layout metrics differ by environment, even when the CSS is identical.

Fix: Run screenshot tests in a consistent browser image and viewport, inject the same stylesheet for baseline and comparison, and avoid assertions that assume a scrollbar must be painted. If the bar is still present, identify whether it is the document, a nested panel, or a browser overlay.

The rule appears to do nothing in an iframe

Cause: The visible scrollbar may be inside an embedded document or component.

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.

Fix: Playwright’s screenshot style is designed to pierce Shadow DOM and apply to inner frames, but the frame must actually be part of the captured page and the selector must match its scrolling element. For a separately navigated or independently captured frame, inject the style into that frame’s page context as well.

Performance and reliability considerations

  • Inject at capture time: Temporary CSS avoids page reloads and does not require modifying application bundles.
  • Wait for the real visual state: Combine page.waitForSelector(), a deliberate delay, or your normal network-idle strategy when late content changes page height. Hiding a scrollbar does not wait for images, fonts, or client rendering.
  • Control the environment: Use a fixed viewport, browser version, device scale factor, and color scheme for stable pixel output.
  • Check lazy content: Full-page output can trigger lazy loading, so allow those resources to settle before capture and ensure that the page’s own loading logic is complete.
  • Keep the CSS minimal: A small, deterministic stylesheet reduces accidental layout changes and makes failures easier to diagnose.
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 when you do not want to maintain Playwright launch settings, waiting logic, and cleanup CSS. It removes cookie banners, newsletter popups, and chat widgets before the shot. Bot checks, blank pages, failed loads, timeouts, and cache hits are not billed, and each response identifies the page verdict and billing status in X-Page-Verdict and X-Billed headers. Its MCP server lets Claude, Cursor, and other MCP clients call take_screenshot, get_page_info, and capture_pdf.

The one-call request returns PNG, JPEG, or WebP (or a PDF when requested):

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.
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp

See the ScreenshotNeo API documentation for capture options, including full-page output and CSS controls. The same request in Python is:

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

r = requests.get(
    "https://api.screenshotneo.com/v1/shot",
    params={"access_key": "YOUR_API_KEY", "url": "https://stripe.com"},
    timeout=90,
)
r.raise_for_status()
open("shot.webp", "wb").write(r.content)

And in Node.js:

const q = new URLSearchParams({
  access_key: 'YOUR_API_KEY',
  url: 'https://stripe.com'
});
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);
if (!res.ok) throw new Error(`Screenshot failed: ${res.status}`);
const fs = await import('node:fs/promises');
await fs.writeFile('shot.webp', Buffer.from(await res.arrayBuffer()));

ScreenshotNeo supports 63 options, including full-page capture with lazy images loaded, CSS-selector element shots, custom CSS and JavaScript, waits, viewport and device presets, dark mode, retina scale, request blocking, cookies and headers, geolocation, caching with a chosen TTL, signed image links, asynchronous webhooks, bulk capture of up to 100 URLs per call, PDF controls, HTML/CSS rendering, and a usage API. Every feature is included on every plan.

Plan Included shots Price
Free 1,000 per month $0, no card
Starter 3,000 $5
Growth 15,000 $15
Pro 60,000 $39
Scale 250,000 $99
Business 1,000,000 $249

Yearly billing provides two months free. You can create a free ScreenshotNeo account with 1,000 screenshots each month and no credit card.

Frequently Asked Questions

Will hiding the scrollbar change the screenshot’s page width?

The visibility-only rules normally preserve scrolling and layout. overflow: hidden can change available width and clipping, so treat it as a different capture state.

Do I need both scrollbar CSS rules in Chromium?

Use both for portability. Chromium/WebKit-style pseudo-elements and the standard scrollbar-width property do not have identical coverage across engines and environments.

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

Why does a full-page screenshot sometimes contain no scrollbar even before CSS injection?

Scrollbar painting depends on the operating system, browser mode, and capture implementation. A missing bar can be normal; visual tests should assert the intended content rather than the presence of native chrome.

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.