How to Hide Cookie Banners in ScreenshotAPI.net Screenshots
Hide most cookie banners in ScreenshotAPI.net captures with no_cookie_banners=true. Learn what to try when an overlay remains, plus a Puppeteer fallback.
To hide cookie banners in a ScreenshotAPI.net screenshot, add no_cookie_banners=true to the request. The documented default is false, so banners normally remain visible unless you enable the option. ScreenshotAPI.net says the feature removes most consent banners; it does not publish a coverage rate or guarantee removal on every site. ScreenshotAPI.net Help · resource-blocking documentation.
1. Enable cookie banner removal
Add this boolean query parameter to your screenshot request:
no_cookie_banners=true
In ScreenshotAPI.net’s query builder, enable the corresponding cookie-banner option. The vendor documents this alongside block_ads=true; enable ad blocking only if you also want ads excluded. Review the resulting image to confirm the page content you need is still visible.
What the option does
The vendor describes the setting as hiding or blocking cookie banners and pop-ups before rendering. Its Help page says it automatically removes “most” cookie consent banners. That is a qualitative description, not a measured success rate. Some site-specific, unusual, or dynamically inserted overlays may remain.
2. If a banner remains
First check that the request actually includes no_cookie_banners=true, spelled correctly and set to true. If the overlay still appears, use a selector or page-specific code for that site. Identify the banner’s actual CSS selector in the page; .cookie-banner below is only a placeholder.
CSS fallback
If your ScreenshotAPI.net workflow supports custom CSS, hide the known element with a rule like this, replacing the selector:
.cookie-banner {
display: none !important;
}
ScreenshotAPI.net documents CSS injection that can target elements by class, ID, or selector. A selector-based rule is appropriate when you know the specific element and want to suppress it without changing unrelated page content. Selectors can break when a site changes its markup, so inspect the page again if the banner returns.
JavaScript fallback
When the site requires an interaction or the element is inserted dynamically, use the service’s supported JavaScript injection to target it before capture. The exact script depends on the page; a generic pattern is:
document.querySelector('.cookie-banner')?.remove();
Replace .cookie-banner with the real selector and ensure the script runs before the screenshot is taken. Use page-specific code cautiously: removing a parent element may also remove useful page content.
3. Puppeteer fallback for direct browser control
If you manage your own browser capture, Puppeteer lets you locate a known banner and hide it before taking the screenshot. This runnable Node.js example uses a placeholder selector; replace it with the selector for your target page.
const puppeteer = require('puppeteer');
(async () => {
const browser = await puppeteer.launch({ headless: true });
try {
const page = await browser.newPage();
await page.goto('https://example.com', { waitUntil: 'networkidle2' });
await page.evaluate(() => {
document.querySelector('.cookie-banner')?.remove();
});
await page.screenshot({ path: 'page.png', fullPage: true });
} finally {
await browser.close();
}
})();
The example uses .cookie-banner as a placeholder, as in the vendor’s Puppeteer guide. Use the correct selector for the page, and choose an appropriate navigation wait condition for the site. Browser automation gives you control over page interaction, but requires a Node.js project, Puppeteer, and a browser runtime. See ScreenshotAPI.net’s Puppeteer guide.
4. Troubleshooting
| Symptom | Likely cause | What to do |
|---|---|---|
| The banner is still visible | The parameter is missing, misspelled, or not enabled; or the overlay is outside the automatic feature’s coverage. | Confirm no_cookie_banners=true is in the actual request. If it is, inspect the page and use a site-specific CSS selector or JavaScript. |
| The screenshot is missing page content | A broad selector or script removed a container that included more than the consent overlay. | Target the smallest banner element you can identify and capture again. |
| The banner returns after a site update | The site’s markup or selector changed. | Inspect the current page and update your CSS selector or script. |
| The page renders incompletely after disabling JavaScript | JavaScript may power page content or rendering behavior. | Do not disable all JavaScript as a general banner fix. The vendor warns that this can break functionality, hide content, or produce incomplete renders. Use a targeted selector or script instead. |
| Ads are still visible | Cookie-banner removal and ad blocking are separate options. | If you also want ads excluded, enable block_ads=true as a separate setting. |
5. Choosing an approach
| Approach | Best for | Trade-off |
|---|---|---|
no_cookie_banners=true |
General ScreenshotAPI.net captures. | The vendor says it removes most banners; check captures where the overlay matters. |
| Custom CSS or injected JavaScript | A known site-specific element or interaction. | Requires the correct selector or script and may need updating when the page changes. |
| Puppeteer | Teams that need direct browser automation control. | Requires browser automation setup and code. |
6. Performance, reliability, and cost considerations
The cited ScreenshotAPI.net documentation explains the banner-removal option but does not provide benchmark results, a numerical removal rate, or a guarantee for every consent platform. Validate important captures by checking representative target pages, particularly after those sites change.
Targeted CSS or JavaScript can address a persistent overlay, but adds a site-specific dependency to maintain. Puppeteer provides control over the browser flow and also means you manage its runtime and capture code. The research sources do not establish pricing for either approach, so check the service’s current pricing and plan details before estimating costs.
Or skip the browser setup
ScreenshotNeo is a website screenshot API and MCP server from Yorker Media. One GET request returns a screenshot or PDF, and its clean-shot flow accepts cookie or consent banners like a visitor, then removes 60+ known consent platforms, newsletter popups, and chat widgets. Each step can be turned off. Only clean shots are billed: bot checks, CAPTCHAs, blank pages, timeouts, failed loads, and cache hits cost nothing, with the result indicated by X-Page-Verdict and X-Billed headers. AI agents can use its MCP server tools take_screenshot, get_page_info, and capture_pdf. Plans include 1,000 screenshots per month free with no card; paid plans start at $5 for 3,000 screenshots. See the ScreenshotNeo website and API documentation.
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,
)
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}`);
Replace YOUR_API_KEY with your key and the example URL with the page to capture. Sign up for 1,000 free screenshots a month with no card.
Frequently asked questions
Is no_cookie_banners enabled by default?
No. ScreenshotAPI.net documents false as the default, so add no_cookie_banners=true to suppress banners.
Does it remove every cookie banner?
The Help page says it removes most consent banners. It does not state a percentage or promise universal coverage.
Should I turn off JavaScript to hide the popup?
No. The vendor warns this can break functionality, hide content, or cause incomplete renders. Prefer the built-in option or targeted CSS or JavaScript.
Can I hide ads at the same time?
Yes. The vendor documents block_ads=true as a separate parameter; enable it only when you also want ads blocked.


