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

For a cookie banner or consent modal rendered in the page, wait for its actual control, choose the consent action you intend, verify the overlay is gone, and then capture the page. In Playwright, that means locating and clicking the site-specific button before calling page.screenshot(). A browser-native JavaScript dialog such as alert() is different: handle it through Playwright’s dialog API.

Dismiss the consent UI before taking the screenshot

A navigation completing does not guarantee a consent banner has appeared, nor that the page is ready to capture. Wait for the relevant control or overlay, interact with the page’s own consent control, and confirm the intended post-consent content is visible. Playwright recommends explicitly waiting for predictable overlays and dismissing them in the normal flow: Playwright Page API.

Playwright example

This Node.js example uses Playwright. Replace the illustrative button locator with one verified for the target site, and choose the label that matches the consent decision you want to record. The example captures the full page after the banner disappears.

const { chromium } = require('playwright');

(async () => {
  const browser = await chromium.launch({ headless: true });
  const page = await browser.newPage();

  try {
    await page.goto('https://example.com', { waitUntil: 'domcontentloaded' });

    // Illustrative only: adapt the role and accessible name to the site.
    const consentButton = page.getByRole('button', {
      name: /accept|agree|reject|necessary/i
    });

    await consentButton.waitFor({ state: 'visible' });
    await consentButton.click();
    await consentButton.waitFor({ state: 'hidden' });

    // Optional: replace this with a locator for the content you expect to see.
    await page.screenshot({ path: 'page.png', fullPage: true });
  } finally {
    await browser.close();
  }
})();

Install Playwright in your project with npm install playwright; if the browser binaries are not already installed, run npx playwright install chromium. The sample selector is not universal: buttons can say “Accept,” “Reject,” “Allow necessary,” or use other wording, and some interfaces use links or custom controls. Do not assume that accepting all cookies is the right action; select the site’s intended option.

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

Choose a readiness condition that fits the page

The example waits for the consent button to become visible, then hidden. If the site delays rendering the banner, this is more meaningful than assuming that navigation completion means the overlay is ready. After dismissal, you can also wait for a known page heading or other content locator before capture if the consent action triggers a reload or changes the page. Avoid an arbitrary fixed delay unless the site gives you no reliable state to wait for.

Handle browser-native JavaScript dialogs separately

alert, confirm, prompt, and beforeunload are browser-native dialogs, not HTML cookie banners. Playwright handles these through its dialog event API. If you register a dialog handler, it must accept or dismiss the dialog; otherwise the action that triggered it can stall. See Playwright dialog documentation.

page.on('dialog', async dialog => {
  await dialog.dismiss();
});

await page.goto('https://example.com');
await page.screenshot({ path: 'page.png', fullPage: true });

Use that handler only when the page may open a native dialog. It does not click or remove a cookie banner, which remains a page-level control.

Capture a full page or just the relevant element

For a full-page screenshot, Playwright’s page.screenshot({ fullPage: true }) captures beyond the current viewport. For a focused capture, take a screenshot of a locator instead:

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
await page.getByRole('main').screenshot({ path: 'main.png' });

Use a locator that identifies the desired content, and ensure it is visible after consent. Puppeteer offers the same broad distinction: Page.screenshot() captures the page, while ElementHandle.screenshot() captures an element. Its guide demonstrates navigation with waitUntil: 'networkidle2', but that is an example rather than a guarantee that every site is ready: Puppeteer Screenshots.

Common problems and fixes

  • The locator times out: the consent UI may not have appeared, or its role/name differs from the example. Inspect the page and use the actual accessible name and control type; do not rely on one selector across unrelated sites.
  • The screenshot still includes the banner: wait for the overlay or consent control to become hidden, then check that the page is showing the state you expect before capturing.
  • Clicking the button does not dismiss it: confirm that the button is actionable and that the chosen control is the intended consent action. Some sites update content or reload after the click, so wait for a meaningful post-action state.
  • The page hangs around network idle: persistent requests can prevent an idle condition. Prefer waiting for the consent control and relevant content; navigation completion alone is not proof the page is ready.
  • A native dialog blocks the flow: add a Playwright dialog handler and explicitly accept or dismiss it. Do not expect the cookie-banner locator to handle native browser dialogs.

Or skip the browser setup

ScreenshotNeo can return a screenshot or PDF with one GET request. Cookie banners are accepted before capture, and known consent platforms, newsletter popups, and chat widgets are removed; each step can be turned off. Only clean shots are billed: bot checks or CAPTCHAs, blank pages, timeouts, failed loads, and cache hits cost nothing, with the result identified in response headers. It also provides an MCP server for AI agents, with tools including take_screenshot, get_page_info, and capture_pdf. The free plan includes 1,000 screenshots per month with no card; paid plans start at $5 for 3,000. See ScreenshotNeo.

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. Sign up for 1,000 free screenshots a month, with no card required.

#1 Best Overall
Sale
Kodak PIXPRO FZ45 16MP Compact Digital Camera, 4X Optical Zoom, AA, Black
  • 16MP Sensor: Captures detailed photos with a CMOS sensor for everyday shooting
  • Optical Zoom: 4x optical zoom with a 27mm wide angle lens for flexible framing indoors or outdoors
  • Full HD Video: Records 1080p video for travel clips, family moments, or simple vlogging
  • Memory Support: Works with Class 10 SD, SDHC, or SDXC cards up to 512GB
  • LCD Screen and Battery: 2.7in LCD screen with 2 AA alkaline batteries for convenient on-the-go use
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Frequently Asked Questions

Can the same consent selector work on every website?

No. Consent controls, labels, and markup vary by site, so verify and adapt the locator for each target.

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.

Should I use Playwright or Puppeteer?

Either supports page screenshots and element screenshots. The practical choice is usually the framework already used in your project.

Quick Recap

SaleBestseller No. 1
Kodak PIXPRO FZ45 16MP Compact Digital Camera, 4X Optical Zoom, AA, Black
Kodak PIXPRO FZ45 16MP Compact Digital Camera, 4X Optical Zoom, AA, Black
16MP Sensor: Captures detailed photos with a CMOS sensor for everyday shooting; Full HD Video: Records 1080p video for travel clips, family moments, or simple vlogging
$99.99
SaleBestseller No. 2
Kodak PIXPRO FZ55 16MP Compact Digital Camera, 5X Optical Zoom, Black
Kodak PIXPRO FZ55 16MP Compact Digital Camera, 5X Optical Zoom, Black
16MP Sensor: Captures detailed photos with a CMOS sensor for everyday shooting; Full HD Video: Records 1080p video for travel clips, family moments, or simple vlogging
$139.99
Bestseller No. 4
Kodak PIXPRO FZ55 16MP Compact Digital Camera, 5X Optical Zoom, Red
Kodak PIXPRO FZ55 16MP Compact Digital Camera, 5X Optical Zoom, Red
16MP Sensor: Captures detailed photos with a CMOS sensor for everyday shooting; Full HD Video: Records 1080p video for travel clips, family moments, or simple vlogging
$139.99
Rank #4
Kodak PIXPRO FZ55 16MP Compact Digital Camera, 5X Optical Zoom, Red
  • 16MP Sensor: Captures detailed photos with a CMOS sensor for everyday shooting
  • Optical Zoom: 5x optical zoom with a 28mm wide angle lens for flexible framing indoors or outdoors
  • Full HD Video: Records 1080p video for travel clips, family moments, or simple vlogging
  • Memory Support: Works with Class 10 SD, SDHC, or SDXC cards up to 512GB
  • Rechargeable Battery: Included LB-012 lithium-ion battery charges in the camera over USB with the supplied adapter in about 2 hours; charge it for at least 4 hours before first use to maximize battery life
Rank #3
Sale
Digital Camera, Latest FHD 1080P Digital Camera for Teens with SD Card Anti Shake Point and Shoot Cameras Portable 16X Zoom Compact Small Cameras for Kids Boys Girls Seniors with Wrist Strap
  • Latest Digital Camera Built-in Fill Light : This compact digital camera is paired with a powerful CMOS processor and image stabilization to help you take & record the most exciting moments in 44 MP quality images & FHD 1080P quality videos anywhere, anytime. Plus, there is also a built-in fill light to help you take high quality pictures even in low light&dark settings, making this the perfect camera for all indoors/outdoors situations.
  • Long-Lasting Battery Life & 16X Digital Zoom :This point and shoot camera will retain its battery charge even after long use. The controls and functions are easy to operate making this the perfect choice for children, teens and younger. This kids camera supports 16x digital zoom, you can zoom in or out the subject by pressing the W/T button for taking still photos to zoom in or out on distant objects and capture all the details you need.
  • Multifunctional & Portable Digital Camera: This cheap digital camera is slim enough to fit in your pocket. You'll easily be able to take it with you on all your indoor/outdoor activities and adventures and ideal for beginners, children and teenagers. This kids digital camera is equipped with 20 filters, anti-shaking, self-timer, continuous shooting, date stamp, time-lapse recording, smile capture, internal MIC and speaker (recording sound videos), great for your daily photography needs.
  • WEBCAM & PAUSE FUNCTION : More than just a FHD 1080p digital camera, it also works as a webcam for video calls and vlogging. Connect the camera to the computer, press shutter and power button at the same time and the camera will automatically turn on webcam mode for all your video calling and live streaming needs. The pause function allows you to pause when seeing playback videos.
  • A Must Have Photography Device : This digital camera with SD card made from high-quality materials, this retro camera is safe and durable. Perfect for all ages to develop & improve their photographic abilities and observation skills. Our dedicated and experienced 24/7 support team is available for all after purchase troubleshooting, questions and technical help.
Rank #2
Sale
Kodak PIXPRO FZ55 16MP Compact Digital Camera, 5X Optical Zoom, Black
  • 16MP Sensor: Captures detailed photos with a CMOS sensor for everyday shooting
  • Optical Zoom: 5x optical zoom with a 28mm wide angle lens for flexible framing indoors or outdoors
  • Full HD Video: Records 1080p video for travel clips, family moments, or simple vlogging
  • Memory Support: Works with Class 10 SD, SDHC, or SDXC cards up to 512GB
  • Rechargeable Battery: Included LB-012 lithium-ion battery charges in the camera over USB with the supplied adapter in about 2 hours; charge it for at least 4 hours before first use to maximize battery life

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.