ScreenshotNeo

BlogHow-to

How to Hide Cookie Banners in ScreenshotOne Screenshots

Use ScreenshotOne’s built-in banner blocker, then target stubborn overlays with CSS selectors. See the request options, code examples, and troubleshooting steps.

By the ScreenshotNeo team4 October 20265 min read

To hide common cookie consent banners in a ScreenshotOne capture, add block_cookie_banners=true to the screenshot request. ScreenshotOne documents this option for cookie banners, GDPR overlays, and other privacy notices; its documented default for URL captures is false, so set it explicitly. If a particular banner remains, use hide_selectors with a selector for that element.

Add the option to the /take request along with your target URL and access key:

https://api.screenshotone.com/take?url=https%3A%2F%2Fexample.com&block_cookie_banners=true&access_key=YOUR_ACCESS_KEY

For a real request, URL-encode parameter values. The examples below show cURL, Python, and Node.js. These are configuration examples, not verified live captures.

cURL

curl -G 'https://api.screenshotone.com/take' \\
  --data-urlencode 'url=https://example.com' \\
  --data 'block_cookie_banners=true' \\
  --data-urlencode 'access_key=YOUR_ACCESS_KEY' \\
  -o screenshot.png

Python

import requests

response = requests.get(
    'https://api.screenshotone.com/take',
    params={
        'url': 'https://example.com',
        'block_cookie_banners': 'true',
        'access_key': 'YOUR_ACCESS_KEY',
    },
    timeout=90,
)
response.raise_for_status()
with open('screenshot.png', 'wb') as image:
    image.write(response.content)

Node.js

const params = new URLSearchParams({
  url: 'https://example.com',
  block_cookie_banners: 'true',
  access_key: 'YOUR_ACCESS_KEY',
});

const response = await fetch(`https://api.screenshotone.com/take?${params}`);
if (!response.ok) {
  throw new Error(`ScreenshotOne returned HTTP ${response.status}`);
}
const image = Buffer.from(await response.arrayBuffer());
await import('node:fs/promises').then(fs => fs.writeFile('screenshot.png', image));

2. Target a banner that the built-in option misses

Use hide_selectors to hide a specific page element. ScreenshotOne accepts multiple selectors and hides matching elements by setting their display style to none !important. Find a selector for the banner in the target page’s markup or browser developer tools, and keep it specific so you do not hide unrelated content.

curl -G 'https://api.screenshotone.com/take' \\
  --data-urlencode 'url=https://example.com' \\
  --data 'hide_selectors=.cookie-banner' \\
  --data-urlencode 'access_key=YOUR_ACCESS_KEY' \\
  -o screenshot.png

.cookie-banner is only an example. It is not guaranteed to match a particular site. If you need both the general blocker and a targeted selector, include both options in the same request.

3. Try heuristic banner blocking as a fallback

If the ordinary blocker does not catch the overlay, ScreenshotOne documents block_banners_by_heuristics=true as another technique. It may help with some pages, but the documentation cautions that the screenshot can be less precise. Review the output for unintended changes.

curl -G 'https://api.screenshotone.com/take' \\
  --data-urlencode 'url=https://example.com' \\
  --data 'block_banners_by_heuristics=true' \\
  --data-urlencode 'access_key=YOUR_ACCESS_KEY' \\
  -o screenshot.png

4. Capture a full page and inspect the result

Cookie blocking can be combined with full-page capture options. Full-page rendering has extra edge cases: some content appears only after scrolling, sticky elements may repeat, and animations or galleries can differ between sections. Inspect the resulting image and tune the relevant delay or scrolling settings if content is missing or repeated.

Banner and ad blocking can also add rendering work because the service listens for requests and applies techniques to hide content. If the page does not have banners, or you are optimizing a site you control, disable blockers you do not need.

5. Choose the right method

Method Use it when Trade-off
block_cookie_banners=true You want the built-in handling for common consent overlays. It is broad; explicitly enable it because the documented URL-capture default is false.
hide_selectors A known, specific banner remains or you need precise control. You must identify a selector that matches the target page and avoids other content.
block_banners_by_heuristics=true The regular blocker misses a banner and you want to try the documented fallback. ScreenshotOne warns this can reduce screenshot precision.

6. Troubleshooting

Symptom Likely cause What to try
The banner still appears. The general blocker did not recognize this site’s implementation, or it was not enabled. Set block_cookie_banners=true explicitly. Then inspect the page and try a specific hide_selectors selector. Heuristic blocking is another option, with a precision trade-off.
Other page content disappears. The selector is too broad or matches multiple elements. Choose a narrower selector and check every match. ScreenshotOne hides all elements matching each selector.
The result is less precise after enabling heuristics. Heuristic banner blocking can hide content based on broader techniques. Compare with the regular blocker or a targeted selector and use the least broad option that removes the overlay.
Full-page content is missing or repeated. Some content loads only on scroll, sticky elements repeat, or animation and gallery states vary. Inspect the full-page output and tune delay or scrolling behavior for the page.
The capture takes longer than expected. Banner or ad blocking can add request-listening and hiding work. Disable blockers that are not needed for the page and capture goal.

7. Or skip the browser setup

ScreenshotNeo is a website screenshot API and MCP server from Yorker Media. Its one-call API can return a PNG, JPEG, WebP, or PDF, and it accepts the parameter names other screenshot APIs use.

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

See the ScreenshotNeo API documentation for request options. Before capture, ScreenshotNeo accepts the cookie or consent banner like a visitor and removes more than 60 known consent platforms, newsletter popups, and chat widgets; each step can be turned off. Bot checks and CAPTCHAs, blank pages, timeouts, failed loads, and cache hits cost nothing, and response headers say what happened and whether the shot was billed. Its 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 screenshots.

Sign up for ScreenshotNeo’s free 1,000 screenshots a month, with no card required.

8. FAQ

No. Its options documentation says the default is false for URL captures, so include block_cookie_banners=true when you need it.

Can I hide more than one element?

Yes. hide_selectors accepts multiple selectors; matching elements are hidden. Use selectors carefully to avoid removing page content.

Is heuristic blocking always more accurate?

No. It is a fallback that may help when regular blocking misses a banner, and ScreenshotOne cautions that precision may be lower.

Can I combine banner blocking with full-page capture?

Yes. The options can be combined. Full-page output may need page-specific tuning because of scroll-triggered content, sticky elements, and animation.

Sources