If a cookie banner returns in every Playwright screenshot, first check whether each capture uses a new browser context. A fresh non-persistent context has isolated browser state, so it will not automatically inherit consent saved in an earlier run. Save the site’s real post-consent state with Playwright’s storageState(), then load it into the context used for the returning-visitor screenshot. If you are testing the first-visit experience, keep the context clean instead.
Why the banner keeps coming back
Playwright browser contexts isolate browser state. A new non-persistent context does not write browsing data to disk, so a later context starts without the consent data from an earlier one unless you explicitly provide it. That makes a repeated banner expected when every screenshot creates a fresh context.
The site may store consent in a cookie, localStorage, sessionStorage, IndexedDB, or a consent manager’s own mechanism. There is no universal cookie name or storage key to assume: inspect what the site actually writes after you accept its banner.
Save consent once and reuse it
The reliable pattern is to accept consent through the site UI, save state after the choice has been committed, and seed the screenshot context with that snapshot before navigating to the page.
Free tools Windows power users keep installed
One-click scans. No signup required.
- Accept through the site UI. Use the same button or control a visitor would use. This lets the site’s consent manager write its expected state.
- Save the resulting state. After the UI has completed and storage has updated, call
context.storageState({ path: 'consent-state.json' }). - Initialize the screenshot context from that file. Create a new context with
storageState: 'consent-state.json', then navigate to the same origin and take the screenshot. - Keep the two test intents separate. Use a clean context when checking that a first-visit banner appears; use saved state for a returning-visitor screenshot.
Playwright’s storage-state snapshot covers cookies and localStorage; IndexedDB capture is optional where the installed version supports it. Check the documentation for your version before relying on newer options such as IndexedDB snapshotting or setStorageState. See the BrowserContext API.
As an Amazon Associate I earn from qualifying purchases.
JavaScript example
Replace the example URL and button locator with the target site’s URL and actual consent control. This pattern illustrates the documented APIs; it is not a site-specific patch.
// First run: perform the site's real consent action, then save state.
const context = await browser.newContext();
const page = await context.newPage();
await page.goto('https://example.com');
await page.getByRole('button', { name: /accept/i }).click();
await context.storageState({ path: 'consent-state.json' });
await context.close();
// Screenshot run: seed a fresh context with that state.
const returningVisitor = await browser.newContext({
storageState: 'consent-state.json',
});
const screenshotPage = await returningVisitor.newPage();
await screenshotPage.goto('https://example.com');
await screenshotPage.screenshot({ path: 'page.png' });
The locator’s label varies by site. If the click triggers an asynchronous consent update, wait for the relevant UI or storage change before saving the snapshot.
#1 Best Overall
- [INTEL POWERED CONTENT] - Built with a 8th Generation Hexa-Core Intel i5 and 32GB of DDR4 RAM; Modern, Windows 11 ready, with 4K support, Executive multitasking, media streaming and smooth, multi-tab web browsing; Perfect as an all-purpose multimedia computer; built for content creators; Plenty of RAM and Mass storage for photo and video editing powered by Intel HD 630
- [LATEST WIRELESS TECH] - This Dell Desktop Computer easily connects to the internet through the Built In WiFi / Bluetooth
- [SOLID STATE STORAGE] - This Dell Computer setup comes with an ultra-fast 1TB Solid State Drive (SSD); Setup as the primary boot device; Boot and load programs with lightning speed ; Additional expansion available
- [BUY & OWN WITH CONFIDENCE] - From the world's largest Microsoft Authorized Refurbisher; Quality Guarantee and Free Tech Support; Award-winning Customer Service; | Support Sustainable Business
- [MODERN HI-SPEED PORTS] - USB 3.0 (x4) | USB 2.0 (x4) | DisplayPort (x1) | HDMI Port (x1) | Audio Combo Jack (x1) | Audio Out (x1) | RJ-45 Ethernet (x1) | Internal SATA (x3)
Find where the consent choice is stored
Inspect browser state immediately after accepting the banner rather than guessing a key name. Playwright’s context cookie APIs can list cookies, and its WebStorage APIs can inspect storage for the current origin. The BrowserContext API documents cookie and storage-state handling; the Page API and current Playwright documentation cover origin-scoped web storage helpers, whose availability can depend on version.
- Cookies: Check the cookie’s domain, path, expiry, and whether the screenshot URL uses the same host. A cookie for one host or path may not apply to another.
- localStorage: It belongs to the current origin, meaning the scheme, host, and port must match. A state created on
https://www.example.comdoes not necessarily apply tohttps://example.com. - sessionStorage: It is session-scoped and cleared when the tab closes, according to Playwright’s storage guide. A cookie-plus-localStorage snapshot may not reproduce a choice stored only there. See Playwright’s session storage guidance.
- IndexedDB: If consent is stored there, verify whether your installed Playwright version’s storage snapshot is configured to include it.
Apply saved state before navigating to the site. If the page is visited first and only then state is modified, the consent manager may already have decided to show the banner.
Diagnose the symptom
| What you see | Likely cause | What to check |
|---|---|---|
| The banner returns in each test, but disappears after you click during that test. | Each test likely starts a fresh context without restored state. | Save a post-consent storage state and pass it to the screenshot context. |
| The state file contains no consent cookie. | The site may use web storage or another store, or the choice had not been committed when state was saved. | Inspect current-origin storage and other relevant stores after the UI interaction. |
| A cookie is present, but the banner still appears. | Its domain, path, or expiry may not match, or the site may require multiple state items. | Compare cookie scope and saved state with the exact screenshot URL. |
| The banner disappears on reload but returns after the tab closes. | The choice may use sessionStorage or another session-lifetime mechanism. | Inspect sessionStorage and the site’s consent behavior. |
| The banner appears even when a state file is supplied. | State may be incomplete, applied too late, scoped to another origin, or followed by a remote consent check. | Confirm state loads before navigation; inspect console and network behavior and the site’s consent manager. The specific cause depends on the site and test code. |
Make the screenshot test deterministic
Do not let one test depend on consent left behind accidentally by another. Give each screenshot a deliberate fixture based on its purpose:
- First-visit test: create a clean context and assert that the banner is visible.
- Returning-visitor screenshot: load a known post-consent state and assert that the banner is absent before capturing.
This also makes failures easier to interpret: a banner in the first test is expected, while a banner in the second points to a state, scope, timing, or site-specific issue.
Quick wins for a faster PC:
Clear out junk files and repair common Windows errorsFree Scan →Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →Repair Windows errors before they cause bigger problemsFix Now →Or skip the browser setup
If your goal is to get a clean screenshot rather than test Playwright’s consent behavior, ScreenshotNeo is a website screenshot API and MCP server. It accepts cookie and consent banners and removes 60+ known consent platforms, newsletter popups, and chat widgets before capture; each step can be turned off. Bot checks or CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed, and the response reports the page verdict and billing status in headers. Its MCP server offers take_screenshot, get_page_info, and capture_pdf for AI agents and MCP clients.
One GET request returns an image or PDF. See the ScreenshotNeo API documentation for parameters and formats.
Rank #2
- Model: Dell OptiPlex 7050 Small Form Factor (SFF)
- Processor: Intel Core i7-7700 3.60 GHz
- Memory: 32GB DDR4 Ram
- Storage: 1TB Solid State Drive (SSD) Fast Boot + Storage
- Operating System: Windows 11 Pro (64-bit)
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://example.com -o shot.webp
The free plan includes 1,000 screenshots per month with no card; paid plans start at $5 for 3,000 shots. Every feature is on every plan. Sign up for 1,000 free screenshots a month, with no card required.
Quick Recap
Best Value
- Connectivity: Includes WiFi, Bluetooth, and LAN for wireless and wired connections
- Memory: Features 16GB DDR4 RAM for smooth multitasking and performance
- Storage: Combines 500GB SSD and 1TB HDD for ample storage space
- Graphics: Integrated Intel UHD Graphics 630 for crisp visuals and video playback
- Design: Sleek desktop tower with black color and slim profile for modern look
Rank #4
- This Certified Refurbished product is tested and certified to look and work like new. The refurbishing process includes functionality testing, basic cleaning, inspection, and repackaging. The product ships with all relevant accessories, a minimum 90-day warranty, and may arrive in a generic box. Only select sellers who maintain a high-performance bar may offer Certified Refurbished products on Amazon.com.
- Dell Optiplex 3050 SFF Desktop computer PC, Intel Quad Core i5-6500 up to 3.6GHz, 16GB DDR4, 256GB SSD
- Includes: USB Keyboard & Mouse, USB WiFi adapter, Microsoft office 30 days free trail.
- Port: Front: USB 3.0(2), USB 2.0(2); Rear: DP, HDMI, USB 3.0(2), USB 2.0(2), RJ-45.
- Support 4K (3840x2160) Dual display, makes it easy to connect two monitors at the same time, and you can expand working Windows, mirror content, or expand a single window across multiple monitors.
Rank #3
- IMMERSIVE 24 INCH DISPLAY: Experience stunning clarity on a Full HD IPS screen with ultra-thin bezels, offering a 90% screen-to-body ratio that makes everything from spreadsheets to streaming come alive with vibrant colors and crisp details.
- POWERFUL INTEL PROCESSING: Tackle demanding tasks with ease thanks to the Intel processor and 16GB of high-speed memory, delivering smooth performance whether you're multitasking between applications or running productivity software.
- GENEROUS STORAGE: Store all your important files, photos, and programs with blazing-fast solid state drive technology that ensures quick boot times, rapid file access, and plenty of space for your digital life.
- ENHANCED PRIVACY AND COLLABORATION: Work confidently with the pop-up privacy camera that tucks away when not in use, plus dual microphones with noise reduction for crystal-clear video calls that keep you connected professionally.
- ECO-CONSCIOUS DESIGN: Feel good about your purchase with an EPEAT Gold registered and ENERGY STAR certified computer that combines premium performance with responsible environmental manufacturing practices.
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.




