The Tool Desk
Outbyte PC Repair FREEClear out junk files and repair common Windows errorsFree Scan →Outbyte Driver Updater FREEFix the driver behind crashes, sound loss and screen glitchesFind Drivers →For a clean, one-off screenshot, pass a narrowly targeted CSS rule to page.screenshot({ style }). It hides the matching element only while Playwright captures the image. If you are testing consent behavior, use the website’s actual accept, reject, or settings controls instead; hiding the banner does not test or save a consent choice.
Hide an overlay in a single screenshot
Use Playwright’s screenshot style option to apply CSS at capture time. Replace the example selectors with ones that match the target website’s DOM:
const { chromium } = require('playwright');
(async () => {
const browser = await chromium.launch();
const page = await browser.newPage();
const url = 'https://example.com';
await page.goto(url);
await page.screenshot({
path: 'page.png',
style: `
#cookie-banner,
[data-testid="cookie-banner"] {
display: none !important;
}
`,
});
await browser.close();
})();
The selectors above are examples, not universal cookie-banner identifiers. Inspect the page and choose a specific selector for its banner or popup. A broad rule such as hiding every div can remove real content.
The screenshot style option accepts stylesheet text and applies it while the screenshot is being made. Playwright documents that it can help with dynamic elements and repeatable screenshots, pierces Shadow DOM, and applies to inner frames. See the Playwright Page API for the current options and version-specific details.
When to use a persistent style tag instead
page.addStyleTag({ content }) adds a style tag to the page. It can make sense if the styling needs to remain active for more than one capture. For a single screenshot, style keeps the change scoped to the capture rather than changing the page for later test steps.
Choose the method that matches the test
| Goal | Method | What it does |
|---|---|---|
| Omit a known banner from one image | page.screenshot({ style }) |
Applies targeted CSS during capture; it does not interact with the site’s consent controls. |
| Test whether consent controls work | Click the site’s accept, reject, or settings control, then assert the resulting UI or state | Exercises the consent flow instead of visually hiding it. |
| Cover sensitive content or mark an area | Screenshot mask with a locator |
Covers the matched element’s bounding box with a colored rectangle; the covered area remains visible as a block. |
| Dismiss an expected popup before an action | Wait for it and dismiss it in the normal test flow | Handles a predictable overlay explicitly. |
| Recover from an unexpected overlay blocking an action | page.addLocatorHandler() |
Runs when Playwright detects the overlay during an actionability or auto-waiting assertion check; it is not a general background monitor. |
Playwright recommends explicitly waiting for and dismissing a predictable overlay in the test flow rather than using page.addLocatorHandler(). Reserve the handler for overlays that are genuinely unexpected. The recommendation and handler behavior are described in the Page API overlay-handler documentation.
#1 Best Overall
- CRISP CLARITY: This 23.8″ Philips V line monitor delivers crisp Full HD 1920x1080 visuals. Enjoy movies, shows and videos with remarkable detail
- INCREDIBLE CONTRAST: The VA panel produces brighter whites and deeper blacks. You get true-to-life images and more gradients with 16.7 million colors
- THE PERFECT VIEW: The 178/178 degree extra wide viewing angle prevents the shifting of colors when viewed from an offset angle, so you always get consistent colors
- WORK SEAMLESSLY: This sleek monitor is virtually bezel-free on three sides, so the screen looks even bigger for the viewer. This minimalistic design also allows for seamless multi-monitor setups that enhance your workflow and boost productivity
- A BETTER READING EXPERIENCE: For busy office workers, EasyRead mode provides a more paper-like experience for when viewing lengthy documents
Test consent, rather than hiding it
If the purpose of the test is to verify consent behavior, locate the actual control using a stable accessible role or site-owned attribute, click it, and assert the expected result. Visual CSS hiding changes the screenshot, but does not operate the consent controls. If persistence matters, reload or revisit the page and assert the expected state after the site’s real consent flow.
Use a mask when a visible cover is acceptable
A mask is useful when an element must be obscured, for example to cover sensitive content. It generally leaves a colored rectangle over the element, so it is not the right choice when the goal is a naturally clean image with the banner absent. Playwright’s screenshot assertion options also support masks and style text or style paths; screenshot assertions are available with the Playwright test runner. See Playwright’s test assertion documentation.
Target the right element, including frames
Find a stable selector
Inspect the banner in the browser’s DOM and look for a stable ID, accessible attribute, or site-owned test attribute. Prefer a selector that targets just the overlay, not a common container shared by page content. Playwright locators resolve elements when used; see the locator guide for targeting options. No single cookie-banner selector works across websites.
When the popup is in an iframe
A selector evaluated against the top-level document cannot select elements in a separate frame’s document. Use a frame locator when you need to target and interact with a frame-scoped element, and determine whether the screenshot-time style reaches the content in your case. Playwright documents screenshot styles as applying to inner frames, but the appropriate frame and element selectors depend on the site.
Rank #2
- CRISP CLARITY: This 22 inch class (21.5″ viewable) Philips V line monitor delivers crisp Full HD 1920x1080 visuals. Enjoy movies, shows and videos with remarkable detail
- 100HZ FAST REFRESH RATE: 100Hz brings your favorite movies and video games to life. Stream, binge, and play effortlessly
- SMOOTH ACTION WITH ADAPTIVE-SYNC: Adaptive-Sync technology ensures fluid action sequences and rapid response time. Every frame will be rendered smoothly with crystal clarity and without stutter
- INCREDIBLE CONTRAST: The VA panel produces brighter whites and deeper blacks. You get true-to-life images and more gradients with 16.7 million colors
- THE PERFECT VIEW: The 178/178 degree extra wide viewing angle prevents the shifting of colors when viewed from an offset angle, so you always get consistent colors
Keep screenshots stable without hiding unrelated content
Removing an overlay can reveal content beneath it or leave a gap if the page reserves space around it. Inspect the captured image rather than assuming that hiding the element produces the desired layout. If the site leaves reserved space, adjust only the relevant site-specific layout rule and verify the result.
For unrelated motion that makes captures inconsistent, Playwright’s screenshot animations option can disable animations. Its documented behavior differs for finite and infinite animations; consult the Page API before relying on a particular result. Disabling animation can help stabilize a capture, but it does not remove an overlay.
Free tools Windows power users keep installed
One-click scans. No signup required.
Rank #3
- Clear visuals. Fluid motion: A 144Hz refresh rate and 1ms MPRT deliver smooth, tear‑free motion across work, gaming, and streaming for clearer, more fluid viewing.
- Eye comfort: TÜV Rheinland 3‑star* certification reduces harmful blue light while preserving stunning color quality without compromise. *TÜV Rheinland 3-star eye comfort certification.
- Wide viewing angle: Get consistent views across a wide 178° /178° viewing angle.
- In-Plane Switching (IPS): See excellent color accuracy and consistency across wide viewing angles with In-plane Switching (IPS) technology.
- Ultra-thin bezels: Maximize your viewing experience with thin bezels.
Troubleshoot banners that remain or leave gaps
- The CSS rule has no effect: The selector may not match the element. Inspect the DOM and replace the example selector with a specific one from the target page.
- The overlay is inside a frame: A top-level selector cannot target a separate frame document. Identify the frame and use a frame-scoped locator for interactions; check the resulting screenshot to confirm the capture-time style reached the relevant content.
- The screenshot has an awkward blank area: The site may reserve space or shift the layout around the overlay. Identify the site-specific layout rule and adjust only what is needed, then inspect the image.
- The banner returns after navigation or reload: Screenshot-time CSS is temporary and does not store a consent choice. Use the actual consent controls if the test needs to verify persistence.
- A locator handler did not run: It is triggered around actions or assertions that perform actionability or auto-wait checks, not simply because an overlay appeared. Dismiss predictable overlays in the regular flow.
- A mask appears as a bright block: That is the expected cover behavior. Use capture-time CSS if the element should look absent, or configure the mask color if a visible cover is appropriate.
Or skip the browser setup
ScreenshotNeo is a website screenshot API and MCP server. A single request can return an image or PDF, and its capture options include CSS selectors, custom CSS and JavaScript, waits, device presets, and full-page capture. Cookie banners, newsletter popups, and chat widgets are removed before the shot; each removal step can be turned off. Bot checks, blank pages, timeouts, failed loads, and cache hits are not billed, and the response says which page verdict and billing status applied.
For example, this cURL request captures a page as WebP:
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
See the ScreenshotNeo API documentation for request options and response details. An MCP server provides take_screenshot, get_page_info, and capture_pdf tools for Claude, Cursor, and other MCP clients. The Free plan includes 1,000 shots a month with no card; paid plans start at $5 for 3,000 shots. Sign up for free and get 1,000 screenshots a month with no card.
Rank #4
- CURVED FOR ENHANCED ENGAGEMENT: An immersive viewing experience with a curved monitor that wraps more closely around your field of vision; It creates a wider view, enhancing depth perception and minimizing peripheral distraction
- SMOOTH PERFORMANCE FOR SEAMLESS CONTENT: Stay in the action when playing games, watching videos, or working on creative projects; The 100Hz refresh rate reduces lag and motion blur so you don't miss a thing in fast-paced moments¹
- MORE GAMING POWER: Gain the edge with optimizable game settings; Color and image contrast can be adjusted to see scenes more vividly and spot enemies hiding in the dark; Game Mode adjusts any game to fill the screen so you can view every detail²
- KEEP IT EASY ON THE EYES: Care for your eyes and stay comfortable, even during long sessions; Advanced eye comfort technology certified by TÜV reduces eye strain by minimizing blue light and reducing irritating screen flicker²
- INCREASED VERSATILITY: Connect to more; Plug devices straight into your monitor for increased flexibility, making your computing environment even more convenient
Frequently asked questions
Does hiding a banner save the user’s consent?
No. A capture-time style changes the screenshot only. Use the website’s consent controls when the test needs to verify a choice or its persistence.
Can I use the same selector on every site?
No. Cookie platforms and site implementations differ. Inspect each target and use a narrow selector that matches its DOM.
Best Value
- 【INTEGRATED SPEAKERS】Whether you're at work or in the midst of an intense gaming session, our built-in speakers provide rich and seamless audio, all while keeping your desk clutter-free.
- 【EASY ON THE EYES】 Protect your eyes and enhance your comfort with Blue-Light Shift technology. This feature reduces harmful blue light emissions from your screen, helping to alleviate eye strain during long hours of use and promoting healthier viewing habits.
- 【WIDEN YOUR PERSPECTIVE】Our sleek minimal bezel design ensures undivided attention. The nearly bezel-free display seamlessly connects in a dual monitor arrangement, delivering an unobstructed view that lets you focus on more at once, completely distraction-free.
Can I hide an overlay with a screenshot mask?
A mask covers the element with a colored rectangle rather than making it disappear into the page. Use screenshot-time CSS when the desired result is an image without the overlay.
Quick Recap
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.

