Quick wins for a faster PC:
Repair Windows errors before they cause bigger problemsFix Now →Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →For recurring screenshots, the most reliable approach is to make a genuine choice in the site’s consent interface once, save that browser state, and reuse it in the scheduled capture. If you only need a clean presentation image, Playwright can instead hide a known banner with capture-only CSS—but that does not record consent or change the site’s behavior.
Choose the approach that matches your goal
| Approach | Use it when | What it changes | Main caveat |
|---|---|---|---|
| Save and reuse browser state | You want scheduled captures to reflect a visitor who has already made a consent choice. | Cookies and local storage from the browser profile can be loaded into later runs. | Storage format and expiry depend on the site and its consent-management platform (CMP); the saved file can be sensitive. Playwright authentication documentation |
| Hide the banner in the screenshot | You need a clean image and the banner is not part of what you are testing or comparing. | A stylesheet hides a verified selector only while the screenshot is rendered. | It does not record consent, stop the CMP displaying the banner, or establish that tracking is appropriate. Playwright Page API |
Cookie banners commonly return because an automated run starts a new or cleared browser context without the state the site expects. Do not assume there is one universal cookie or local-storage key: the exact name and behavior depend on the website and CMP.
Save a real consent choice with Playwright
This example uses Playwright’s JavaScript API. Run the setup once in a controlled profile, make the appropriate choice through the site’s own consent interface, and save the resulting storage state. Then load that state in each scheduled screenshot run.
1. Create the state file through the site’s interface
Install Playwright if it is not already part of the project, then save this as setup-consent.js. Replace the URL with the target page. The script pauses so you can make the choice yourself; it does not guess or set a consent flag.
As an Amazon Associate I earn from qualifying purchases.
const { chromium } = require('playwright');
(async () => {
const browser = await chromium.launch({ headless: false });
const context = await browser.newContext();
const page = await context.newPage();
await page.goto('https://example.com', { waitUntil: 'domcontentloaded' });
console.log('Make the appropriate choice in the site’s consent UI.');
console.log('When finished, return to this terminal and press Enter.');
await new Promise((resolve) => process.stdin.once('data', resolve));
await context.storageState({ path: 'playwright/.auth/consented-state.json' });
await browser.close();
})();
Make sure the directory playwright/.auth exists before running the script. For a project using a different module setup, adapt the require line to its module system. Playwright’s authentication guide describes saving and reusing browser state.
2. Load the saved state for scheduled captures
Use storageState when creating the context. This runnable example saves a full-page PNG after the page loads:
#1 Best Overall
const { chromium } = require('playwright');
(async () => {
const browser = await chromium.launch({ headless: true });
const context = await browser.newContext({
storageState: 'playwright/.auth/consented-state.json'
});
const page = await context.newPage();
await page.goto('https://example.com', { waitUntil: 'networkidle' });
await page.screenshot({ path: 'scheduled-shot.png', fullPage: true });
await browser.close();
})();
Run the same command or script from your scheduler, ensuring it points to the same state file and intended domain. State may be scoped to particular domains or paths by the site’s implementation, and it may expire or be invalidated. Confirm the saved profile works against the actual page you capture.
Protect the state file
A saved browser state is not a harmless screenshot setting. Playwright warns that “The browser state file may contain sensitive cookies and headers that could be used to impersonate you or your test account.” Keep it out of public storage and source control; restrict access and manage it like a credential. If the site offers a choice that is specific to a test profile, use that profile rather than an account with unnecessary access.
Rank #2
Use capture-only CSS when appearance is the only concern
For a comparison where the banner is outside the subject of the test, provide a stylesheet to page.screenshot(). Replace the example selector with one inspected on the target site:
await page.screenshot({
path: 'scheduled-shot.png',
fullPage: true,
style: `
.verified-consent-banner,
#verified-cookie-notice {
display: none !important;
}
`
});
The selectors above are illustrative, not universal: inspect the page and use the actual banner selector. Playwright documents that the screenshot style option can pierce Shadow DOM and apply to inner frames, which can help when a known banner is nested there. See the Page API documentation. This styling affects the captured rendering; it does not save a consent decision or prevent the CMP from presenting the banner on later visits.
Keep a fresh profile to test first visits
Do not use the consented state for every test. Keep a separate fresh context—or a separate state file created without prior site data—to verify the first-visit experience. That lets recurring screenshots represent the chosen returning-visitor state while tests can still catch a changed, broken, or missing consent interface.
PC Slower Than It Used to Be?
A free scan shows the junk files, broken settings and background clutter dragging Windows down - then fixes them in one click.Free scan · Windows 10 & 11Outdated Drivers Are Slowing You Down
One free scan finds every outdated or missing driver and matches the right update for your exact hardware.Free scan · exact hardware matchWhere consent is used as the legal basis for personal-data processing, the European Data Protection Board says it must be “freely given, informed, specific and unambiguous,” and people must be able to withdraw it. Its small-business guidance also says storing or accessing cookies on a user’s terminal equipment requires adequate information and consent; cookie rules also involve the ePrivacy Directive. These are general EU materials, not site-specific legal advice or a complete statement of the rules in every jurisdiction. See the EDPB’s guide to processing personal data lawfully and its FAQ on cookies.
Rank #3
Troubleshoot banners that still appear
The banner returns on every scheduled run
- Check that the scheduled job loads the intended state file and creates its context with
storageState. - Confirm the state was saved after making a choice on the target site, and that the scheduled capture uses the same relevant domain and path.
- Inspect the site’s own storage and CMP configuration if the state stops working. Do not guess a cookie name or copy a flag from another site; there is no universal key.
- Check whether the site has expired or invalidated the saved state, and repeat the legitimate setup flow if needed.
The CSS does not hide the banner
- Verify the selector in the live page rather than relying on a generic cookie-banner selector.
- Check whether the element is inside an iframe or Shadow DOM. Playwright’s screenshot stylesheet is documented to apply to inner frames and pierce Shadow DOM, but the selector still needs to match the actual element.
- Consider whether the banner appears after navigation or after a delay. If so, wait for the relevant page state before capturing; hiding it only helps once the element is present in the rendered capture.
Visual comparisons remain inconsistent
Keep the capture environment aligned with the baseline. Playwright notes that rendering can vary with host operating system, browser version, settings, hardware, power source, headless mode, and other factors. Pinning the browser and keeping machine and run settings steady helps distinguish genuine page changes from environment noise. See Playwright’s visual comparison guidance.
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 clean-shot workflow accepts cookie or consent banners and removes more than 60 known consent platforms, newsletter popups, and chat widgets before capture; each step can be turned off. Bot checks, blank pages, timeouts, failed loads, and cache hits cost nothing, with the outcome identified in response headers. Its MCP server provides take_screenshot, get_page_info, and capture_pdf for AI agents and MCP clients.
Example cURL request (replace the target URL and supply your API key):
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. The free plan includes 1,000 screenshots per month with no card; paid plans start at $5 for 3,000. Sign up for free.
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.




