ScreenshotNeo

BlogHow-to

How to Hide Cookie Banners in Urlbox Screenshots

Use Urlbox’s banner, accept, Escape, selector, or custom code options to clear consent UI. Learn which method fits and what to try when a banner remains.

By the ScreenshotNeo team4 October 20266 min read

To ask Urlbox to hide detected cookie banners in a screenshot, set hide_cookie_banners=true. It applies a visual hiding treatment to detected banners; it does not mean the page’s accept button was clicked. If you want the page to follow its acceptance interaction, set click_accept=true. Detection is not guaranteed on every site, so use a site-specific selector or custom CSS or JavaScript when a banner remains.

1. Choose whether to hide or accept

These options have different effects. Hiding suppresses the banner in the rendered screenshot. Clicking accept attempts to interact with the page’s consent UI. Choose based on the state you need to capture, and do not treat visual hiding as evidence that consent was recorded.

Option Effect Use it when
hide_cookie_banners=true Attempts to detect and hide cookie banners. The options reference describes applying display: none !important. You need a clean visual capture and do not need to trigger the page’s accept interaction.
click_accept=true Attempts to click a likely accept button. The capture should reflect the page after its acceptance interaction.
Both options Urlbox documents a request example that combines them. You want to attempt acceptance and also ask the banner cleanup to run. Verify the resulting page state for your target site.

Urlbox describes automatic banner handling as working on most websites, not all websites. The options are attempts, so test the particular URLs and page states in your workload. [Urlbox screenshots documentation](https://urlbox.com/docs/screenshots) · [Urlbox render options](https://urlbox.com/docs/options)

2. Add the option to your Urlbox render request

Include the target URL and the boolean option in the render parameters. This is the option configuration; use the request endpoint, authentication, and parameter encoding from your existing Urlbox integration or the current [Urlbox API documentation](https://urlbox.com/docs/).

{
  "url": "https://example.com",
  "hide_cookie_banners": true
}

To attempt an accept click as well:

{
  "url": "https://example.com",
  "hide_cookie_banners": true,
  "click_accept": true
}

Urlbox’s screenshot guide also shows these banner options alongside block_ads and block_urls for a full-page capture. Those last two options have different jobs: block_ads targets ads, while block_urls blocks selected network requests. They are not substitutes for banner handling. See the [screenshots guide](https://urlbox.com/docs/screenshots) and [render options reference](https://urlbox.com/docs/options) for current request syntax and option behavior.

3. Handle a banner that automatic detection misses

  1. Inspect the page. Identify the banner’s container and a selector specific enough to avoid hiding unrelated page content.
  2. Try hide_selector. Supply the CSS selector or selectors for the banner. Urlbox documents support for element, class, ID, complex, and comma-separated selectors.
  3. Check the layout. The options reference says selector hiding uses visibility: hidden !important and pointer-events: none !important, preserving layout. That differs from the documented display: none !important behavior for detected cookie banners; a reserved banner area may remain.
  4. Try Escape for a dismissible modal. press_escape=true sends Escape before capture and may dismiss a popup or overlay if the site handles that key.
  5. Use custom CSS or JavaScript when needed. For a site-specific banner, custom page code can target its markup or trigger the site’s own interaction. Keep the code narrow and validate the captured result.

Urlbox documents these as available approaches, but their success depends on the site’s markup and behavior. See [render options](https://urlbox.com/docs/options) and Urlbox’s guide to [blocking popups and hiding cookie banners](https://urlbox.com/block-pop-ups).

4. Capture a full page

For full-page screenshots, Urlbox recommends considering both click_accept and hide_cookie_banners. A banner may affect what appears during page rendering, so inspect the resulting image rather than assuming that one option covers every page state.

{
  "url": "https://example.com",
  "full_page": true,
  "hide_cookie_banners": true,
  "click_accept": true
}

The current Urlbox render-options reference lists a plan requirement for full_page (Ultra or above). Plan names and requirements can change, so check the [live options reference](https://urlbox.com/docs/options) before relying on that detail.

5. Verify the captured state

  • Confirm the banner is absent in the output, including at the top, bottom, and in full-page captures.
  • If you used click_accept, check that the page actually moved to the expected state; the option attempts a click and may not find the right control.
  • If using hide_selector, check whether the hidden element’s layout space remains.
  • Repeat the check for each materially different site or banner variant in your capture set.

6. Common problems and fixes

Symptom Likely cause What to try
The banner is still visible. Automatic detection did not match this site’s banner, or its markup differs from the detected patterns. Inspect the element and use a narrow hide_selector; if needed, use custom CSS or JavaScript.
The banner disappears, but consent may not have been recorded. hide_cookie_banners hides the visual banner; it is not an accept interaction. Use click_accept=true if the page should attempt its acceptance flow, then verify the resulting state.
The page still has a blank region where the banner was. hide_selector preserves layout according to the options reference. Use the automatic banner option if it detects the banner, or adapt site-specific CSS/JavaScript to the desired layout.
Escape does nothing. The page may not dismiss that overlay on Escape. Use a specific selector or custom page code instead.
A full-page request is unavailable. The current plan may not include the documented full_page option. Check the live plan and options documentation.
Ads or unwanted requests remain. Banner controls do not block ads or network requests. Configure block_ads or block_urls for their respective purposes.

7. Performance, reliability, and cost considerations

Cookie-banner cleanup is part of the render configuration, but the cited Urlbox documentation does not provide a timing benchmark or a guarantee that every banner will be detected. Do not assume identical results across sites. For reliable output, validate representative pages and use site-specific selectors or code for known exceptions. Check Urlbox’s current plan and pricing information for the cost and availability of the options you need.

Keep request blocking separate from visual cleanup: blocking requests can change what the page loads, while hiding a banner changes what is shown. Use the narrowest configuration that produces the intended capture, then review the rendered image.

Or skip the browser setup

If you would rather call a screenshot API, ScreenshotNeo accepts a URL in one request and returns an image or PDF. Its capture cleanup accepts cookie/consent banners and removes 60+ known consent platforms, newsletter popups, and chat widgets before the shot; each step can be turned off. Bot checks, blank pages, timeouts, failed loads, and cache hits cost nothing, and responses include X-Page-Verdict and X-Billed headers. An MCP server gives AI agents tools to take screenshots, get page information, and capture PDFs. The free plan includes 1,000 screenshots a month with no card; paid plans start at $5 for 3,000.

cURL:

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

Python:

import requests

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

Node.js:

const q = new URLSearchParams({ access_key: 'YOUR_API_KEY', url: 'https://example.com' });
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);

See the ScreenshotNeo API documentation for request options. Create a free account for 1,000 screenshots a month with no card.

Frequently asked questions

The documented hide option suppresses the banner visually. Urlbox documents a separate accept-click option. These technical behaviors alone do not establish what consent state a site records.

Can I hide more than one banner element?

The options reference supports comma-separated CSS selectors for hide_selector. Use selectors that identify only the elements you intend to hide.

Will Escape work for every popup?

No. It can dismiss overlays that respond to Escape; use a selector or custom code if the page does not.

Where can I confirm current Urlbox behavior and plan requirements?

Check the live [render options](https://urlbox.com/docs/options) and [screenshots guide](https://urlbox.com/docs/screenshots), since service details may change.