To remove an unwanted scrollbar from a Playwright screenshot, use the screenshot API’s style option to apply temporary CSS to the element that actually scrolls. This keeps the change out of your app’s permanent styles. If a scrollbar is missing and you want it included, first check whether you are capturing the viewport, the full document, or a nested scrolling element—fullPage does not expand nested scroll containers.
Hide an unwanted scrollbar in the screenshot
Playwright’s Page screenshot API accepts a style string. Playwright applies that stylesheet while rendering the screenshot, so you can scope a scrollbar-hiding rule to the page or panel that owns the scroll without changing the application’s normal stylesheet.
Start by identifying the scroll owner. Page-level scrolling is associated with the document root; a panel may scroll independently through its own overflow styling. Apply a CSS rule that hides the scrollbar for the relevant element, then capture:
await page.screenshot({
path: 'screenshot.png',
style: `
/* Replace this with a scrollbar-hiding rule for the actual scroll owner. */
`,
});
The placeholder is deliberate: the correct selector and CSS depend on the page, browser, and scrolling element. There is no single unscoped rule established here as a universal cross-browser fix. Verify the rule against your target browser and the element that scrolls.
Do these 3 things before closing this tab:
1Clear out junk files and repair common Windows errors2Fix the driver behind crashes, sound loss and screen glitches3Repair Windows errors before they cause bigger problems#1 Best Overall
Keep the style limited to the screenshot
Using style avoids adding a screenshot-only rule to your production CSS. If the screenshot still shows a bar, check that your selector matches the scrolling element and that the element is the one with the scrollbar; hiding a bar on the document root will not necessarily affect a nested panel.
If the scrollbar is missing but you want it
Confirm the capture scope before changing CSS. Playwright’s fullPage screenshot option captures the document’s scrollable content; it does not take a sequence of ordinary viewport screenshots, nor does it expand every independently scrollable panel. The option defaults to false. See the screenshot API documentation.
Rank #2
- Viewport capture: captures the currently visible page area. A scrollbar may depend on the browser and operating-system rendering environment.
- Full-page capture: captures the document’s scrollable content. It does not expand a nested scroll container.
- Element capture: targets a particular element. For a nested scrolling panel, capture the container itself and check whether the visible portion or the content you need is represented in the result.
Playwright collaborator Dgozman summarized the nested-container distinction in a response to issue #12962 on March 24, 2022: “The behavior you describe is expected. Full page screenshots do not expand any scrollable container in the page. Instead, they render the full scrollable content of the document itself.” Issue #12962.
Troubleshoot by capture scope and environment
- The bar remains after adding screenshot CSS: inspect the page to identify which element scrolls, then scope the rule to that element. A nested panel and the document may need different selectors.
- A full-page image omits the scrollbar: full-page capture represents document content, not necessarily a visible scrollbar in the rendered output. A report against Playwright 1.50.1 on Windows 11 describes this outcome; it is an environment-specific report, not a universal guarantee. Issue #35328.
- A nested panel is cut off: capture the panel element rather than expecting
fullPage: trueto expand it. The full-page option applies to the document’s scrollable content. - A launch flag appears ineffective: issue reports include attempts to change the
--hide-scrollbarsargument, but they do not establish it as a reliable switch across screenshot modes. Prefer the documented screenshot-timestyleoption when you need to hide a bar, and verify behavior in your browser and OS. Issue #35328 and Issue #12962.
When diagnosing a difference between local and CI screenshots, record the Playwright version, browser, operating system, capture type, and scroll owner. Scrollbar rendering and screenshot behavior should not be generalized from one reported environment to every setup.
Or skip the browser setup: use ScreenshotNeo
If you need a website screenshot without configuring Playwright, ScreenshotNeo provides a screenshot API. One GET request returns an image or PDF; for this example, request a screenshot of the page you want to capture:
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 request options. Cookie and consent banners, newsletter popups, and chat widgets are removed before capture; these steps can be turned off. Bot checks, blank pages, failed loads, timeouts, and cache hits are not billed, and response headers report the page verdict and billing status. An MCP server provides take_screenshot, get_page_info, and capture_pdf tools for AI agents. The Free plan includes 1,000 screenshots per month with no card; paid plans start at $5 for 3,000 shots.
Sign up for ScreenshotNeo’s free plan to get 1,000 screenshots a month with no card.
Quick Recap
Rank #4
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.




