Use BrowserContext.deleteMatchingCookies(...filters) to delete selected cookies from one Puppeteer browser context without clearing cookies in other contexts. The method returns a promise, so await it. Before choosing filters, check the DeleteCookiesRequest type in the Puppeteer version installed in your project: the API reference names that type but does not enumerate its fields or matching rules.
Choose the browser context that owns the cookies
Cookies belong to a browser context, and contexts have isolated storage. A call on one context does not clear cookies in every context. If the page whose cookies you want to change is available, get its context and call the method there:
As an Amazon Associate I earn from qualifying purchases.
const context = page.browserContext();
await context.deleteMatchingCookies(...filters);
Here, filters must be one or more filter objects accepted by the DeleteCookiesRequest type in your installed Puppeteer release. The code shows the method and scope, not a particular filter schema.
If you create a separate context for a task, use that same context for the page and cookie deletion. Puppeteer’s BrowserContext documentation describes contexts as isolated user contexts and shows creating a context, opening a page in it, and closing the context when finished.
#1 Best Overall
Use filters supported by your installed Puppeteer version
The method reference documents the signature as deleteMatchingCookies(...filters: DeleteCookiesRequest[]): Promise<void> and says it deletes cookies matching the supplied filters in that browser context. It does not, in the reference available here, list the request type’s fields or define wildcard, partial-name, domain-normalization, or path-matching behavior. Do not assume those semantics.
Cookie data documented by Puppeteer includes a name, domain, path, and optional partition key. For partitioned cookies, Puppeteer’s CookieData reference describes the partition key as matching the top-level site. These are cookie data dimensions; they do not, by themselves, establish that every dimension is accepted by every release’s deletion filter.
Rank #2
- Check the Puppeteer package version used by the project and inspect its
DeleteCookiesRequesttype and matching-deletion reference. - Build the filter object or objects using only fields and semantics established for that version.
- Pass those filters to the intended context’s
deleteMatchingCookiescall and await the promise.
The method reference currently identifies its API documentation as version 25.4.0, while the BrowserContext class reference identifies version 25.12.0. Those labels are documentation versions, not a compatibility guarantee for an arbitrary installed package. Check your own package rather than copying a filter shape from an unrelated release.
Do these 3 things before closing this tab:
1Repair Windows errors before they cause bigger problems2Fix the driver behind crashes, sound loss and screen glitches3Clear out junk files and repair common Windows errorsUse the Browser shortcut only for the default context
Browser.deleteMatchingCookies(...filters) is a shortcut for browser.defaultBrowserContext().deleteMatchingCookies(...filters). Use it when the default context is the intended storage area:
Rank #3
await browser.deleteMatchingCookies(...filters);
If the page belongs to a separately created context, use page.browserContext() and call the context method instead. The browser shortcut does not mean that all contexts are cleared. Puppeteer’s Browser class reference documents the default-context shortcut.
Inspect cookies and avoid the obsolete page method
To inspect cookies for a particular context, use that context’s cookies() method. The browser-level cookies() shortcut addresses the default context, as described in Puppeteer’s Browser.cookies() reference.
Rank #4
Do not build new code around Page.deleteCookie(). Puppeteer marks that page-level API obsolete and directs users to browser or context cookie APIs, including the matching-deletion methods. See the Page.deleteCookie() reference.
Quick wins for a faster PC:
Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →Clear out junk files and repair common Windows errorsFree Scan →Scan for outdated or missing drivers - takes under a minuteDriver Scan →Troubleshoot matching deletion
- The cookie remains: First verify that the page and deletion call use the same context. Then verify the filter fields and matching semantics against the installed version’s
DeleteCookiesRequesttype; do not infer partial matching or wildcard support. - The code rejects a filter: The filter shape may not match the installed release. Check that release’s type definition and API documentation rather than relying on a schema from a different version.
- Unrelated cookies disappear: Confirm that the filter is as selective as intended and that the call targets the right context. The documented method deletes cookies matching its supplied filters; its exact matching semantics depend on the version-specific request definition.
- TypeScript reports a type error: Compare the filter object with the installed package’s
DeleteCookiesRequesttype. The method reference names the type but does not list its fields in the available reference excerpt.
Or skip the browser setup
If your goal is a screenshot rather than cookie-state control in your own browser automation, ScreenshotNeo offers a one-request screenshot API. It accepts consent banners as a visitor and removes 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 are not billed, and responses include X-Page-Verdict and X-Billed headers. Its MCP server provides screenshot tools for AI agents.
Example cURL request (see the ScreenshotNeo API documentation):
Best Value
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
The Free plan includes 1,000 screenshots per month with no card; paid plans start at $5 for 3,000. Sign up for ScreenshotNeo’s free plan.
Frequently Asked Questions
Does deleting matching cookies return the deleted cookies?
No. Puppeteer’s documented return type is Promise<void>.
Recommended Free Tools
Can I use the same deletion call to clear cookies in every browser context?
No. The context method is scoped to the context on which it is called.
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.




