Back to Blog
productcookiesgdpr

Cookie Banners: Why Screenshot APIs Fail and How We Solved It

FastScreenshotAPI Team3 min read

If you have ever tried to take automated screenshots of European websites, you know the pain: a giant cookie consent banner covers half the page. Your carefully automated pipeline produces screenshots that are unusable because a "We value your privacy" modal is blocking the content.

This is not a niche problem. Since GDPR enforcement began, over 80% of European websites and a growing number of sites worldwide display cookie consent banners. For anyone building screenshot automation, this is a serious issue.

The Problem

Most screenshot APIs take a simple approach: navigate to the URL, wait for the page to load, and capture. But "loaded" does not mean "ready for a screenshot." Cookie banners typically appear after the main content loads, often with animations and overlays that obscure the page.

Common workarounds that don't really work:

  • Adding a delay — banners appear at unpredictable times, and a fixed delay either wastes time or is not long enough
  • Injecting CSS to hide banners — there are hundreds of different consent management platforms (OneTrust, Cookiebot, CookieYes, Quantcast, etc.), each with different class names and structures
  • Using ad blockers — they block tracking scripts but often leave the consent UI visible or break the page entirely

How We Solved It

FastScreenshotAPI uses a multi-layered approach to handle cookie banners automatically:

We maintain a database of consent management platforms and their accept mechanisms. When a page loads, we detect which CMP is in use and interact with it the way a real user would — by clicking the "Accept" or "Accept All" button.

2. Generic Banner Detection

For custom-built consent banners that do not use a known CMP, we use heuristic detection. We look for common patterns: fixed/sticky positioned elements with keywords like "cookie," "consent," or "privacy" that contain button elements. This catches the long tail of custom implementations.

3. Graceful Fallback

If we cannot confidently identify and dismiss a banner, we fall back to smart CSS injection that targets common overlay patterns without breaking the page layout. This ensures you always get a usable screenshot.

The Results

With automatic cookie banner dismissal enabled (it is on by default), you get clean screenshots without any extra configuration:

bash
curl "https://api.fastscreenshotapi.com/v1/screenshot?url=https://example.eu&format=png" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  --output clean-screenshot.png

No special parameters needed. No delays. No CSS hacks. Just a clean screenshot of the actual content.

When You Want the Banner

Sometimes you actually want to see the cookie banner — for compliance auditing, for example. In that case, you can disable auto-dismissal:

bash
curl "https://api.fastscreenshotapi.com/v1/screenshot?url=https://example.eu&dismiss_banners=false" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  --output with-banner.png

Try It Yourself

Head to the Playground and try screenshotting any European news site or e-commerce store. You will see clean, banner-free results by default. Check the API docs for the full list of banner-related parameters.