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

If a cookie banner covers your Puppeteer screenshot, first decide whether the capture should show a real visitor making a consent choice or simply show the page layout without the overlay. For a real consent flow, interact with the site’s actual choice and wait for the banner to close. For a visual-only capture, use a fresh browser context and hide only the verified banner element with a narrowly targeted CSS rule. Hiding a banner changes the screenshot; it does not grant consent.

Choose the right fix for the screenshot’s purpose

Puppeteer captures the page as it is rendered, so a banner that is still visible will appear in the screenshot. There is no universal Puppeteer switch or selector that removes cookie banners: the implementation belongs to each website or consent manager. See the Puppeteer Page API.

  • Testing a visitor journey: keep the banner visible, make the intended accept, reject, or other consent choice through the page, then wait for the resulting state before capture.
  • Checking the underlying layout: apply a temporary, narrowly scoped visual override to the confirmed banner element immediately before capture. Do not describe this as a consent action.

Make each run’s browser state reproducible

A previous run may have stored consent in cookies or local storage, making a later run behave differently. Create a fresh BrowserContext when you need an isolated run: Puppeteer documents that contexts do not share cookies or local storage. A fresh context can make the banner appear again, which is expected when that context has no saved consent. See Puppeteer browser management.

Use persisted state only when it is part of what you intend to test. Otherwise, a fresh context helps prevent an earlier consent choice from silently changing the next screenshot.

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

Inspect the page and handle the banner deliberately

  1. Open the target page and inspect its consent UI. Identify the real banner, its controls, and whether it is in the main document, an iframe, or a shadow root. Do not guess a selector: the target site and provider determine the correct element and interaction.
  2. For a user-flow test, click the intended consent control. Use the site’s actual accept or reject choice, as appropriate to the test. Wait for the resulting state rather than removing the element.
  3. For a layout-only image, target only the verified overlay. Inject a temporary style for the exact element. Avoid broad rules that could also hide page content.
  4. Wait for the relevant state, then capture. Wait for the banner to disappear in a consent-flow test, or for your visual override and page readiness in a layout capture.

Example: hide a verified banner for a visual-only capture

This pattern is for layout inspection only. Replace [site-specific-cookie-banner] with a selector you confirmed on the target page. The placeholder is not a real selector, so the code is not runnable until you replace it with the page’s actual selector.

await page.goto(url);
await page.waitForSelector('[site-specific-cookie-banner]');
await page.addStyleTag({
  content: '[site-specific-cookie-banner] { display: none !important; }',
});
await page.screenshot({ path: 'screenshot.png' });

Page.addStyleTag() and Page.screenshot() are page capabilities; the selector and CSS are your site-specific implementation, not built-in cookie-banner handling. If the banner is inside an iframe or shadow root, a selector aimed at the top-level document may not reach it. Puppeteer documents Page.screenshot() in its Page API.

Keep visual cleanup separate from consent tests

Use distinct test cases and label their outcomes clearly. A test that clicks a consent choice checks a user flow and may change stored consent state. A test that hides an element checks the underlying visual layout only. Treating those as the same result can make a screenshot misleading.

When extension-based handling is involved

Puppeteer’s project overview says it runs headless by default and provides a JavaScript API to control Chrome or Firefox. A surfaced older example required headful mode for one extension-based consent setup; that observation does not establish a general headless limitation for extensions today. Check the compatibility of the specific extension and setup rather than assuming either mode will work. See the Puppeteer overview.

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

Cookie and browser-context API note

Current Puppeteer Page documentation marks page-level cookie methods as deprecated and directs users to Browser or BrowserContext cookie APIs. Prefer the current context-level interfaces when managing browser cookies. See the Page API.

#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

Or skip the browser setup

ScreenshotNeo is a website screenshot API and MCP server. One GET request captures a page; its consent cleanup accepts the banner like a visitor and removes more than 60 known consent platforms, newsletter popups, and chat widgets before capture. Each cleanup step can be turned off. Bot checks or CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed; response headers report the page verdict and billing status. AI agents can use its MCP tools, including take_screenshot, get_page_info, and capture_pdf.

For example, this cURL request saves a WebP capture of Stripe:

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 setup and request options. The Free plan includes 1,000 screenshots per month with no card; paid plans start at $5 for 3,000. Sign up for ScreenshotNeo’s free plan.

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.
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
Rank #3
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.
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
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Troubleshooting

  • The banner remains after injecting CSS: verify the selector against the live page and check whether the banner is in an iframe or shadow root. A top-level document selector may not reach either.
  • The banner appears only on some runs: compare browser state. A prior context may have persisted consent; use a fresh BrowserContext for isolated, repeatable runs.
  • The banner reappears in a fresh context: this is expected if the site has no saved consent in that context. Choose a consent action for a real user-flow test, or apply a visual-only override for a layout capture.
  • An extension does not behave as expected in headless mode: compatibility depends on the particular extension and setup. The available older example only establishes a headful requirement for its own setup, not a universal rule.
  • A cookie method is deprecated: consult current Puppeteer guidance and use Browser or BrowserContext cookie APIs instead of deprecated page-level methods.

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.