What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
For an ordinary cookie banner rendered in the webpage, identify and click the site’s actual consent control, wait until the banner is hidden, and then call page.screenshot(). The banner’s selector and button label depend on the site; Puppeteer does not provide a universal cookie-banner selector. The example below is a pattern to adapt, not a drop-in selector for every site.
Dismiss an in-page cookie banner before taking a screenshot
- Navigate to the page and allow its content and consent interface to load. There is no single navigation wait condition that works for every site.
- Inspect the consent UI and identify the relevant button by its accessible name, visible text, or a stable selector. Puppeteer supports CSS selectors and documents text and accessibility selector syntax. Prefer a selector grounded in the actual page rather than guessing a class or assuming the button says “Accept.”
- Use a locator to click the control. Puppeteer recommends locators for page interaction; their actions wait for readiness conditions such as visibility, enabled state, viewport placement, and bounding-box stability, and retry when an action cannot yet proceed.
- Wait for the banner to become hidden using its real selector. Do not treat a completed click as proof that the overlay has disappeared.
- Capture only after dismissal is confirmed.
Illustrative Puppeteer pattern (replace url, the button test, and the banner selector with details observed on your target page):
await page.goto(url);
await page.locator('button').filter(button => button.textContent?.trim() === 'Accept').click();
await page.waitForSelector('[data-cookie-banner]', { hidden: true });
await page.screenshot({ path: 'page.png' });
This assumes a button whose text is exactly “Accept” and a banner matching [data-cookie-banner]. Neither is a Puppeteer standard. If you need a failure to be explicit, let the hidden-selector wait time out and handle that timeout rather than silently saving a screenshot that still contains the banner.
Choose a selector that matches the real consent UI
Prefer stable, meaningful controls
Use the control the site actually presents, such as a button with an accessible name or a stable attribute, and verify that your selector targets the intended choice. A broad selector like button alone can match multiple controls; filtering by observed text is illustrative but can also be brittle if wording or whitespace differs.
Account for asynchronous rendering
The banner may appear after navigation or after other page content loads. Select and wait based on the target site’s observed behavior. Do not assume that one fixed delay or one navigation wait mode covers every consent implementation.
Verify dismissal before capture
page.waitForSelector(selector, { hidden: true }) is a documented way to wait until a selector is hidden. Use the actual banner selector and a timeout appropriate to the page. If the wait fails, investigate whether the selector is wrong, the click did not take effect, or the page did not reach the expected state.
Cookie banners are not browser-native JavaScript dialogs
A typical consent banner is HTML rendered inside the page, so interact with it as a page element using a locator or selector. Puppeteer’s separate Dialog API handles browser-native JavaScript dialogs dispatched through the page’s dialog event, such as alerts or prompts; its accept() and dismiss() methods are not the normal way to close an in-page cookie banner.
Capture the page or just one element
After the banner is confirmed hidden, page.screenshot() captures the page. If your goal is a particular element rather than the full page, Puppeteer also supports ElementHandle.screenshot(). Choose the capture target based on what the screenshot needs to show.
Recommended Free Tools
Troubleshoot a banner that remains in the screenshot
- The click times out or does nothing: Confirm that the selector matches the visible consent control and that its label or attributes match the page. Check whether the intended control is enabled and whether another overlay blocks it.
- The wait for hidden times out: Confirm the banner selector against the rendered page. The banner may use a different element, remain visible after the chosen action, or have appeared asynchronously.
- The screenshot is taken too early: Ensure the hidden-state wait completes before calling
page.screenshot(). A click finishing alone does not verify that the banner has gone. - You used
page.on('dialog')for an HTML banner: Switch to a locator or selector interaction. Reserve the Dialog API for browser-native JavaScript dialogs. - Your selector works on one site but not another: Consent markup and wording vary by site. Inspect each target and avoid treating an example selector as universal.
Or skip the browser setup
For a one-call screenshot without managing Puppeteer setup, try ScreenshotNeo. It accepts cookie/consent banners like a visitor and removes 60+ known consent platforms, newsletter popups, and chat widgets before capture; each step can be turned off. Bot checks/CAPTCHAs, blank pages, timeouts, failed loads, and cache hits cost nothing, and responses identify the page verdict and billing status in headers. Its MCP server gives AI agents tools for screenshots, page information, and PDF capture. The free plan includes 1,000 shots a month with no card; paid plans start at $5 for 3,000 shots. See the ScreenshotNeo API documentation.
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
Sign up for 1,000 free screenshots a month, with no card required.
As an Amazon Associate I earn from qualifying purchases.
Version context
The cited Puppeteer documentation pages identify versions 25.12.0 for screenshot, interaction, locator, and wait APIs; Dialog material appears at versions 25.11.0 and 25.12.0. Check the documentation for the version used by your project if an API detail differs.
Quick Recap
Best Value
- 【Protect Privacy Security】Focusing on network security, now we can easily and effectively protect personal and family privacy security , Just gently slide the slide and close the camera, you can stop the intrusion of hackers.
- 【 Ultra Thin Design】The new ultra-thin design, with a thickness of only 0.022 inches, is made of flexible ABS material and is not fragile. Will not affect the closing of the laptops and scratch the laptops.
- 【Easy to install】 Strong adhesive makes the cover not fall, keep the screen clean and free of stains during installation, tear off the adhesive tape on the back, align it with our camera, and press hard for 10 seconds to work.
- 【Compatible with 】Compatible with camera for Laptop, tablet, computers, Echo Show and Apple Devices,as: MacBook Pro,Macbook Air,iMac ,Mac mini,iPad,MacBook Air, iPhone 6/7/8 Plus etc front camera .
- [What you get] 6 pack black webcam covers.
Rank #4
- 【Premium Webcam Cover】This webcam privacy cover is an accessory of computer webcam. No worry about interfering with web camera lens use or indicator light; No damage to your device in any way as well. A helpful privacy protector and dust separator
- 【Privacy Protector】Slide the web camera cover over your webcam lens when not in use, and prevents web hackers from Spying on you. It is perfect to provide privacy security and peace of mind to individuals, groups, organizations, companies and governments. It also protects your camera lens from dust, and keeps it in high-definition resolution all the ways
- 【Durable Material】The web cam cover is made of high-strength plastic, which ensures that your privacy is protected for a long and lasting period of time. The back of the web camera privacy cover slide also has a strong 3M adhesive layer. It helps the privacy protector stick firmly to your device. The most convenient, super thin design, and extra mini size, make it perfectly combine with your devices
- 【Wide Compatibility】This webcam cover is compatible with most popular webcams with flat area surrounding lens or with protruding lens, such as Logitech HD Pro Webcam C920 C920x C930e and C922, Logitech C615 and C270 (NOT fit Logitech C910, B910, C310). It can be also used as a cover for the peep hole on door
- 【For Logitech Webcam Cover】 The streamcam cover kit comes with 2 pack. Please clean the lens surface before applying. Make sure the mounting surface is cleaned completely so that it sticks properly and firmly
Rank #3
- Note: Not suitable for MacBooks released after 2023 or devices with a protruding front camera; Not applicable to full-screen or notch-style tempered glass screen protectors; Do not use on the rear camera of the phone.
- 💻 Why Do You Need a Webcam Cover Slide? — Safeguard your privacy by covering your webcam with our reliable webcam cover when not in use. Don't let anyone secretly watch you. Stay protected!
- ✅ Thin & Stylish — Enhance your laptop's functionality and aesthetics with our 0.027" ultra-thin webcam covers. Seamlessly close your laptop while adding a touch of sophistication.
- ✅ Fits Most Devices — Compatible with laptops, phones, tablets, desktops! Keep your privacy intact on Ap/ple, Mac/Book, iPh/one, iP/ad, H/P, L/novo, De/ll, Ac/er, As/us, Sa/msung devices.
- ✅ 365 Days Protection — Our upgraded 3.0 adhesive ensures a strong hold that won't damage your equipment. Experience reliable, long-term privacy protection day in and day out.
Rank #2
- Privacy Protection: CloudValley webcam cover is designed for those who prioritize privacy, security, and peace of mind when using laptops, tablets, and computers
- Fashion Design: The space aluminum alloy webcam cover features a subtle design which compliments the beautiful aesthetic of top devices
- Ultra-Thin Design: Measures only 0.023 (0.6 mm) inch thin, ensuring it does not interfere with closing your laptop or device while providing reliable camera coverage
- Broad Compatibility: Works flawlessly with most laptops (MacBook, HP, Dell, Asus, Acer, Lenovo), All-in-One PCs and leading tablets including iPad, Surface Pro, Galaxy Tab, Fire HD, and Google Pixel Tablet
- Simple to Use: Only need to align to the webcam, attach and press it firmly for 15 seconds. Does not interfere with web use or indicator light
#1 Best Overall
- Privacy Protection and Lens Care: Avoid private information from hacking while preventing dust-fall and scratching of the camera lens
- Multiple Compatibility: Suitable for Logitech webcam C920x, C920, C922, C930e, C922x Pro Stream HD Camera
- Artful Design: Modeled and designed exclusively to fit the above devices from Logitech and make it more stylish
- Easy Flip Mechanism: Can be turned 180 angle and easily take the cover off when flipping more than 180
- Simple Installation: Attaches securely to your Logitech webcam without leaving residue, allowing for quick and hassle-free setup
Frequently Asked Questions
Does Puppeteer have a universal cookie-banner selector?
No. Inspect the target page and use its actual consent control and banner selector.
Why doesn’t Puppeteer’s Dialog API close my cookie banner?
That API handles browser-native JavaScript dialogs. Most cookie banners are page elements and should be handled with locators or selectors.
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.




