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

To remove a cookie banner reliably, handle it before you capture: load the page, wait for its consent UI, identify the real control (including any iframe), click the intended option when you need to record a genuine consent decision, wait until the banner is hidden or detached, and then take the screenshot. Chrome’s Headless command line can capture and control timing, but it cannot discover or click a site-specific consent control by itself. Use Puppeteer or the Chrome DevTools Protocol (CDP) when interaction is required.

What “remove” should mean in an automated capture

A clean image and a recorded consent decision are different outcomes. If your test, archive, or documentation must represent what a visitor selected, activate the page’s visible consent control and verify the resulting state. Merely hiding the banner with CSS or JavaScript changes the rendered page without recording consent; use that technique only for controlled pages and workflows where the alteration is acceptable.

Cookie systems differ by site. The banner may be native HTML, injected after load, rendered inside an iframe, or replaced by a different component for each locale. There is no universal selector that works across all consent-management platforms. Inspect the target page’s rendered DOM, accessible labels, iframe structure, and post-click behavior for every site you automate.

Choose the right capture method

Situation Best fit Why
One-off, static page with no interaction Chrome Headless CLI Built-in screenshot, viewport, timeout, virtual-time, and DOM-dump flags.
Site-specific consent click Puppeteer Provides page interaction, waiting, screenshots, and network interception in one automation library.
Existing protocol-based infrastructure CDP Low-level Page, Network, and script-injection operations without adding a high-level framework.
Production capture without maintaining a browser ScreenshotNeo Removes known consent banners, popups, and chat widgets before capture; only clean shots are billed.

The Chrome Headless command-line interface is useful for timing, but --timeout only bounds how long Chrome waits and --virtual-time-budget advances time-dependent page code. Neither flag identifies or clicks a consent UI.

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

Use Chrome Headless for a basic screenshot

Install a fixed Chrome version in your build image, then capture a deterministic viewport:

chrome --headless --screenshot=page.png --window-size=1440,1000 https://example.com

Add a bounded wait when the page needs time to render:

chrome --headless --screenshot=page.png 
  --window-size=1440,1000 
  --timeout=10000 
  https://example.com

When a page’s scripts depend on virtual time rather than real network latency, add a budget:

#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
chrome --headless --screenshot=page.png 
  --window-size=1440,1000 
  --virtual-time-budget=5000 
  https://example.com

These commands do not dismiss a banner. They are appropriate only when the page is already in the desired consent state, for example because a profile contains a prior choice. To investigate what Chrome actually rendered, use:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
chrome --headless --dump-dom https://example.com > rendered.html

--dump-dom reports the DOM after parsing and script execution, not the original source HTML, so it helps reveal late-injected consent elements.

Dismiss a banner with Puppeteer

Puppeteer is the practical default when you must inspect a rendered page, click a consent control, wait for a visible state change, and capture afterward. The following Node.js program is runnable after installing Puppeteer with npm install puppeteer. Replace the selector with the control used by your page; do not assume the example selector works elsewhere.

const puppeteer = require('puppeteer');

(async () => {
  const browser = await puppeteer.launch({headless: true});
  const page = await browser.newPage();
  await page.setViewport({width: 1440, height: 1000, deviceScaleFactor: 1});
  await page.goto('https://example.com', {waitUntil: 'domcontentloaded', timeout: 60000});

  // Wait for the page-specific consent control to appear.
  const accept = '[data-testid="accept-cookies"]';
  await page.waitForSelector(accept, {visible: true, timeout: 15000});
  await page.click(accept);

  // Wait for an observable result, not an arbitrary sleep.
  await page.waitForFunction((selector) => {
    const el = document.querySelector(selector);
    if (!el) return true;
    const style = getComputedStyle(el);
    return style.display === 'none' || style.visibility === 'hidden' || el.getBoundingClientRect().height === 0;
  }, {}, accept);

  await page.screenshot({path: 'clean.png', fullPage: true});
  await browser.close();
})();

Inspect before you automate

  • Open the page in a normal browser and use DevTools to find the actual button label, role, or stable attribute.
  • Check whether the control appears only after a delay, after scrolling, or after a locale-specific request.
  • Record the state you expect after clicking: banner detached, hidden, a consent cookie written, or content unlocked.
  • Prefer an accessible role/name or a stable data attribute over a generated class name.

If the banner is inside an iframe, wait for the frame and query inside it:

const frame = page.frames().find(f => f.url().includes('consent.example'));
if (!frame) throw new Error('Consent iframe did not load');
const button = await frame.waitForSelector('button[aria-label="Accept all"]', {visible: true});
await button.click();
await frame.waitForSelector('button[aria-label="Accept all"]', {hidden: true, timeout: 10000});

Some implementations replace the iframe after a click. In that case, wait for the banner container in the main page to disappear or for the relevant consent cookie/state to change, rather than retaining a stale frame handle.

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

When hiding is intentional rather than consenting

For a controlled mock site or a visual-regression test that deliberately excludes overlays, inject a style immediately before capture:

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
await page.addStyleTag({content: `
  #cookie-banner, .newsletter-modal, .chat-widget { display: none !important; }
`});
await page.screenshot({path: 'overlay-free.png', fullPage: true});

This produces a clean image but does not prove that the site accepted cookies. Keep this path separate from tests that validate consent behavior, and document the selectors as part of the test fixture.

Use CDP when you need lower-level control

CDP exposes the Page domain for screenshot capture and script injection on new documents, and the Network domain for cookie operations. The protocol is tied to the Chrome build you run; check the protocol version available in that build because tip-of-tree documentation can change.

Cookie deletion is not a universal banner fix. A site can store consent in local storage, a first-party service, an iframe, or a server-side account. Clear cookies only when your test intentionally resets state, then observe whether the banner actually returns.

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.
const client = await page.target().createCDPSession();
await client.send('Network.clearBrowserCookies');
await client.send('Page.addScriptToEvaluateOnNewDocument', {
  source: 'window.__captureRun = "fresh";'
});
await page.goto('https://example.com', {waitUntil: 'networkidle0'});
const shot = await client.send('Page.captureScreenshot', {format: 'png', captureBeyondViewport: true});
require('fs').writeFileSync('cdp.png', Buffer.from(shot.data, 'base64'));

Use direct CDP calls when another system already manages Chrome through the protocol or when you need precise Page/Network sequencing. Puppeteer is simpler when your main task is selecting and clicking page elements.

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.

A reproducible workflow for CI

  1. Pin the environment. Fix the Chrome version, Puppeteer version, viewport, device scale factor, URL, locale, timezone, and test account state.
  2. Load and observe. Navigate with a bounded timeout and wait for the consent interface or a known page-ready condition.
  3. Identify the control. Handle the main document and every relevant iframe; use the site’s actual accessible label or stable selector.
  4. Choose the outcome. Click the visible consent option for a recorded decision, or use an explicit CSS-injection fixture when visual-only removal is intended.
  5. Verify the transition. Wait for the overlay to hide or detach and check the expected cookie, storage value, or unlocked content.
  6. Capture. Take the screenshot only after verification; use full-page capture when the document height matters.
  7. Diagnose failures. Save a DOM dump, console log, network log, and a pre-click screenshot so you can distinguish a selector error from a page-load failure.

Prefer state-based waits such as waitForSelector, a hidden-state wait, or a specific network response over fixed sleeps. A sleep can be too short on a slow CI runner and waste time on a fast one.

Troubleshooting common failures

The selector times out

The banner may be injected later, localized, behind an iframe, or absent because consent already exists. Inspect --dump-dom, list frames, confirm the locale, and increase the navigation timeout only after verifying that the page is reachable.

The click succeeds but the banner remains

You may have clicked a decorative element, a button in a stale frame, or a preference control that requires a second “save” action. Wait for the actual hidden/detached state and inspect the post-click DOM and cookies.

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

The page is blank or incomplete

Do not interpret a timeout or bot check as a successful clean capture. Check console and network errors, wait for a meaningful content selector, and retain the failure artifact. A longer virtual-time budget cannot repair a blocked request.

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 banner returns on every run

Use a persistent browser profile only when repeatable consent persistence is intended. Otherwise, make the fresh-state behavior explicit and set the site’s consent through its real control on each run. Clearing cookies alone may not clear other storage or account state.

The screenshot differs between machines

Pin Chrome, fonts, viewport, device scale factor, timezone, locale, and network conditions. Lazy-loaded images may require scrolling or a full-page capture strategy before the final screenshot.

An iframe cannot be found

Wait for frame creation after navigation, match the frame by a stable URL or name, and fail with a diagnostic listing of current frame URLs. Never assume the iframe URL is identical across regions.

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

Performance, reliability, and cost considerations

  • Startup: Reuse one browser process and create isolated pages or contexts for batches instead of launching Chrome for every URL.
  • Waiting: Use the narrowest observable readiness condition. Network-idle waits can stall on analytics or long-polling connections; a specific content selector is often more reliable.
  • Full-page images: They consume more memory and time than a fixed viewport. Capture only the required region when a full document is unnecessary.
  • State isolation: Separate contexts prevent one site’s cookies from changing another site’s banner behavior.
  • Retries: Retry transient navigation failures with a limit, but do not silently retry a failed consent click; preserve the failure state for diagnosis.
  • Reproducibility: Store the URL, Chrome version, viewport, locale, selector, and consent outcome beside each artifact.

Or skip the browser setup

ScreenshotNeo is a website screenshot API and MCP server for developers. It accepts the consent banner like a visitor and removes more than 60 known consent platforms, newsletter popups, and chat widgets before capture; each step can be turned off. Bot checks and CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed, and response headers report the page verdict and billing result.

One GET request returns PNG, JPEG, WebP, or PDF. The API also supports full-page and selector captures, dark mode, device presets or custom viewports, retina scale, PDF paper and page options, custom CSS and JavaScript, pre-capture clicks, selector hiding, selector/delay/network-idle waits, request and resource blocking, headers, cookies, user agents, authorization, timezone and geolocation, transparent backgrounds, resizing, configurable-TTL caching, signed image links, asynchronous jobs with signed webhooks, bulk capture of up to 100 URLs per call, usage reporting, and an OpenAPI specification. Common parameter names used by other screenshot APIs also work.

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 documentation for parameters and response headers. Equivalent Python and Node.js calls are:

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}`);

An MCP server provides take_screenshot, get_page_info, and capture_pdf tools for Claude, Cursor, and other MCP clients. The Free plan includes 1,000 shots per month without a card; paid plans start at $5 for 3,000 shots. Create a free ScreenshotNeo account.

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

Frequently asked questions

Can a Chrome timeout flag remove a cookie banner?

No. It controls waiting only. Banner removal requires a site-specific interaction or an intentional rendering alteration.

Should I accept all cookies in an automated test?

Only when that is the consent outcome your test is meant to record. Otherwise, choose the site’s intended option and verify the resulting state.

Is Puppeteer required for headless screenshots?

No. Chrome’s CLI can capture a page without a library; Puppeteer becomes useful when you must inspect and interact with rendered controls.

Will deleting cookies always make the banner appear?

No. Consent can also depend on other browser storage, iframe state, server-side accounts, locale, or implementation-specific logic.

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.