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

Short answer: wkhtmltoimage has no universal “remove cookie banner” switch. For a page you own, use the site’s consent-component state. For an authorized third-party capture, inspect the rendered page and apply a narrowly scoped CSS rule, run page-specific JavaScript with --run-script, or supply a cookie state the site actually recognizes. Use --javascript-delay when the banner appears asynchronously. Hiding a banner in an image changes the rendering; it does not create, prove, or revoke visitor consent.

Choose the method that matches your situation

Situation Preferred approach Why
You control the website Set the component’s intended visibility or consent state Application logic remains truthful and maintainable.
You only need a clean image Targeted CSS hiding Changes the screenshot without pretending a consent decision occurred.
The banner is created or removed by code --run-script plus a suitable delay Lets the page finish loading before your site-specific action runs.
The site recognizes a known consent state --cookie or --cookie-jar Reuses the site’s own cookie semantics; values are never universal.

Before choosing, inspect the target page and confirm that you are authorized to capture it. A selector, cookie name, or script that works on one consent platform can fail—or hide legitimate content—on another.

If you control the website

Change the banner through the component or application configuration rather than modifying a production screenshot command. GOV.UK’s cookie-banner component documents a hidden state for client-side implementations: setting hidden: true hides the whole banner when your JavaScript controls when it appears. Apply the equivalent supported state in your own framework, staging environment, or screenshot route. Do not disable production consent behavior merely to make an image look cleaner.

Keep capture and consent separate

A hidden element is a visual outcome. Consent is a recorded choice with consequences for cookies and third parties. A 2019 technical assessment describes revocation as deleting the consent cookie and communicating withdrawal to third parties that received consent. Therefore, a clean screenshot must not be described as evidence that a visitor accepted or rejected cookies.

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

Hide a known banner with CSS

CSS is the most direct option when you need visual removal only. First use browser developer tools or the page source to identify the actual banner element. Then inject a narrowly scoped rule. The following OneTrust selector is an example documented by an HTML/CSS-to-image vendor, not a universal selector:

#onetrust-consent-sdk {
  display: none !important;
}

Replace it with a selector confirmed in your target page. Avoid broad rules such as hiding every element whose class contains “cookie”; they can remove navigation, legal text, or application content.

Supplying a stylesheet to wkhtmltoimage

The wkhtmltopdf project’s library settings document a userStyleSheet setting. Whether your command-line package exposes an equivalent stylesheet option varies by build, so check the local binary:

#1 Best Overall
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
wkhtmltoimage --help | less
wkhtmltoimage --extended-help | less

If your build supports a user stylesheet, point it at a file containing the confirmed selector. If it does not, use the JavaScript method below to append a style element after load, or render an intermediate HTML wrapper that includes the rule.

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

Run page-specific JavaScript after load

The Debian wkhtmltoimage(1) manual documents --run-script for executing JavaScript and --javascript-delay for waiting after page load. This is useful when a consent manager inserts the banner asynchronously.

wkhtmltoimage 
  --enable-javascript 
  --run-script "(function(){var s=document.createElement('style');s.textContent='#onetrust-consent-sdk{display:none!important}';document.head.appendChild(s);})();" 
  --javascript-delay 1500 
  https://example.com page.webp

The delay is in milliseconds. There is no fixed value that works for every site: a slow consent manager, blocked resource, or late client-side route may need more time. Start with a modest delay, inspect the result, and increase it only when the page demonstrably finishes later. Keep the script specific to the authorized target.

When a script should remove the node

Some banners block the viewport with a backdrop as well as the dialog. In that case, hide both confirmed elements or remove them in one site-specific script:

(function () {
  ['#onetrust-consent-sdk', '.confirmed-backdrop-selector'].forEach(function (selector) {
    document.querySelectorAll(selector).forEach(function (node) { node.remove(); });
  });
})();

Do not copy the placeholder selector. Inspect the page and include only selectors you can verify. Removing a node can trigger application errors if the page expects it later; CSS hiding is safer when it produces the required image.

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

Use cookies only when the site defines the state

wkhtmltoimage documents --cookie and --cookie-jar; its library settings also document a cookie-jar path. These options let the renderer send or persist cookies, but the documentation does not define a universal “consent accepted” cookie.

Send a cookie explicitly

wkhtmltoimage 
  --cookie consent_cookie_name consent_cookie_value 
  https://example.com page.png

Substitute the exact name and value documented by, or observed from, the site you control. Do not guess a value and call it valid consent. Names, encodings, expiry, domains, and meanings differ between implementations.

Persist a cookie jar

wkhtmltoimage 
  --cookie-jar /path/to/cookies.txt 
  https://example.com page.png

A jar can preserve state between captures when the site sets it. Confirm file permissions and whether your installed build reads and writes the format as expected. A jar that contains no recognized consent state will not suppress the banner.

Site-owner configuration: a safer workflow

  1. Create a dedicated screenshot or staging route.
  2. Set the banner component’s documented visibility state there (for example, the GOV.UK component’s hidden: true client-side state).
  3. Keep analytics, consent storage, and production behavior unchanged unless the route is intentionally part of your product.
  4. Capture that route with wkhtmltoimage and verify that the resulting page still contains the content you intended to show.

What wkhtmltoimage can and cannot guarantee

  • It converts an HTML page into an image and provides documented JavaScript, delay, cookie, and cookie-jar controls.
  • It does not document a generic cookie-banner removal flag or a universal selector.
  • A delay does not guarantee that every asynchronous framework has settled.
  • A cookie only has meaning to the site that issued it.
  • Visual hiding does not establish consent, revoke consent, or notify third parties.

Troubleshooting common failures

The banner still appears

Check the selector in the final rendered DOM, not an unhydrated HTML response. The banner may be inside an iframe, inserted after your script runs, or controlled by a different class in mobile layout. Increase --javascript-delay cautiously and run a script that targets the element after it exists.

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

The selector hides nothing

Confirm spelling, capitalization, and whether the element is in a shadow DOM or iframe. A CSS rule in the parent document cannot directly style cross-origin iframe content. In that case, use the consent manager’s supported configuration or capture an authorized page state where the frame is already dismissed.

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.

The screenshot is blank or incomplete

Wait for the page’s critical content rather than relying on an arbitrary delay. Verify JavaScript is enabled, test the URL in the same environment, and inspect wkhtmltoimage --extended-help for build-specific options. Large client-side applications may not be fully compatible with an older Qt WebKit renderer.

The script causes errors

Use defensive checks such as document.querySelectorAll(...) and avoid removing nodes that application code requires. Keep the script short, quote it correctly for your shell, and test the exact command interactively.

The cookie jar has no effect

Inspect the jar for the correct domain, path, expiry, and consent value. Confirm that the site actually uses that cookie to control display. A cookie copied from another domain or an expired entry will be ignored.

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.
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

Content is covered by an invisible overlay

Consent systems often add a backdrop separately from the dialog. Inspect stacking contexts and target the backdrop with a second, narrowly scoped rule. Do not hide every fixed-position element; that can remove legitimate navigation or alerts.

Performance and repeatability

CSS injection is usually cheaper than waiting for a long interaction flow. JavaScript with a delay adds predictable time to every capture, while cookie jars can reduce repeated setup only when the state remains valid. For reproducible builds, pin the wkhtmltoimage package and record the output format, viewport, URL, script, delay, and cookie source. Recheck selectors when the site’s frontend changes.

Capture only pages you are permitted to access. Respect authentication boundaries, rate limits, and robots or contractual restrictions that apply to your use case; removing a banner does not grant permission to copy the page.

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 is a hosted screenshot API and MCP server. Its capture pipeline accepts cookie and consent banners, newsletter popups, and chat widgets before the shot, so the output is clean without maintaining wkhtmltoimage scripts. Only clean shots are billed: bot checks or CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed, and each response reports the page verdict and billing status in X-Page-Verdict and X-Billed headers.

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

One GET request returns PNG, JPEG, WebP, or PDF. The API also supports full-page lazy-image loading, CSS-selector element capture, device presets and custom viewports, retina scale, custom CSS and JavaScript, clicks, wait conditions, blocked resources, headers, cookies, user agents, authorization, timezone, geolocation, transparent backgrounds, resizing, chosen cache TTLs, signed image links, asynchronous webhooks, bulk capture of up to 100 URLs per call, usage reporting, and an OpenAPI specification. Its MCP server exposes take_screenshot, get_page_info, and capture_pdf to Claude, Cursor, and other MCP clients.

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

curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp

Python

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)

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(`HTTP ${res.status}`);
const fs = await import('node:fs/promises');
await fs.writeFile('shot.webp', Buffer.from(await res.arrayBuffer()));

See the ScreenshotNeo documentation for parameters and response headers. The Free plan includes 1,000 shots each month with no card; paid plans start at $5 for 3,000 shots, and every feature is included on every plan. Create a free ScreenshotNeo account.

FAQ

Is there a universal wkhtmltoimage flag for cookie banners?

No. The documented controls are JavaScript, delay, cookies, and cookie jars; removal remains site-specific.

Does hiding a banner mean I accepted cookies?

No. It changes pixels only. Consent must be handled and recorded by the website’s own logic.

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

Should I always use a cookie jar?

Only when the target site defines and recognizes the stored consent state. Otherwise use a verified visual selector or the site’s configuration.

Why does a rule work in my browser but not in wkhtmltoimage?

The renderer may use a different DOM, JavaScript timing, viewport, or iframe context. Inspect the page in the capture environment and adjust the selector or delay.

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.