How to Clear Permission Overrides in Puppeteer
Use Puppeteer’s BrowserContext.clearPermissionOverrides() to reset every permission override in that context. Learn when to use a separate context and how to avoid common mistakes.
Call and await clearPermissionOverrides() on the Puppeteer BrowserContext where you set the overrides. It clears all permission overrides for that context, across origins; it is not a one-origin reset.
const context = browser.defaultBrowserContext();
await context.overridePermissions('https://example.com', ['clipboard-read']);
// Run the work that needs the permission override.
await context.clearPermissionOverrides();
The method returns a promise, so await it before relying on the reset. See the Puppeteer API reference.
1. What the method clears
Puppeteer documents BrowserContext.clearPermissionOverrides() as clearing all permission overrides for the browser context on which it is called. The underlying Chrome DevTools Protocol operation resets permission management for all origins in the selected context. That means calling it clears overrides associated with other origins in that context too. It does not target just the origin passed to overridePermissions().
The method clears permission overrides. It does not close or recreate the browser context. Context lifecycle operations such as close() are separate.
2. Runnable examples
Clear overrides in the default context
Use the default browser context when your automation already runs there. This example assumes browser is an open Puppeteer Browser instance.
const context = browser.defaultBrowserContext();
await context.overridePermissions('https://example.com', ['clipboard-read']);
try {
const page = await context.newPage();
await page.goto('https://example.com');
// Perform the work that needs clipboard-read permission.
} finally {
await context.clearPermissionOverrides();
}
The finally block ensures the cleanup runs if the work throws. If your workflow has multiple overrides in this context, the clear call resets all of them.
Clear overrides in an isolated context
A separate context can help isolate automation tasks. Puppeteer’s browser management guide describes contexts as isolating cookies and local storage, and says closing a context closes its pages. A new context is not required just to clear overrides.
const context = await browser.createBrowserContext();
try {
const page = await context.newPage();
await context.overridePermissions('https://example.com', ['geolocation']);
await page.goto('https://example.com');
// Perform the isolated task.
await context.clearPermissionOverrides();
} finally {
await context.close();
}
Here the explicit clear documents the permission reset before context cleanup. Closing the context is a separate lifecycle choice. See the Puppeteer browser management guide.
3. Scope, context choice, and lifecycle
| Choice | What it does | When it fits |
|---|---|---|
| Clear on the existing context | Resets all permission overrides in that context. | Reuse the context after a task while keeping its lifecycle. |
| Use a separate context, then clear | Scopes the reset to that context; context isolation also separates cookies and local storage. | Keep automation tasks isolated while retaining control of context cleanup. |
| Close a separate context | Closes that context and its pages. | End the isolated task and discard that context’s lifecycle. |
Always call the clearing method on the same BrowserContext that received the override. The default context is valid too; Puppeteer maps it to the protocol’s default-context behavior.
4. Common errors and fixes
| Problem | Cause | Fix |
|---|---|---|
clearPermissionOverrides is not a function |
The method was called on a Page, or on an object that is not a Puppeteer BrowserContext. |
Call context.clearPermissionOverrides() on the context that received the override. |
| Permissions appear unchanged immediately after the call | The returned promise was not awaited. | Use await context.clearPermissionOverrides() before the next operation that depends on permission state. |
| An override for another origin stopped working | The clear operation resets all overrides in the selected context, not just one origin. | Reapply any overrides the remaining workflow still needs after clearing. |
| The override still seems active | The clear call may have been made on a different context from the one that set the override. | Keep a reference to the context used for overridePermissions(), and clear on that same object. |
| The context or pages disappeared | The code closed the context as part of cleanup; clearing permissions alone does not close it. | Separate permission reset from context.close() and close only when the task’s lifecycle is complete. |
5. Reliability and operational notes
- Await cleanup: The API returns
Promise<void>. Await it before proceeding on the assumption that permissions are reset. - Use cleanup structure: Put the reset in a
finallyblock when the context will be reused after operations that may fail. - Track context ownership: Keep the context reference alongside the task so overrides are cleared in the correct scope.
- Check installed versions: Puppeteer and browser versions in a project can differ from the current API documentation. Confirm behavior against the versions actually installed.
The Puppeteer API, browser management guide, and Chrome DevTools Protocol describe the method and scope; the examples above combine those documented operations. No performance or cost claim is relevant to this permission reset call.
6. Or skip the browser setup
If your goal is to capture a webpage rather than manage a Puppeteer permission workflow, ScreenshotNeo provides a screenshot API and MCP server for developers. One GET request returns a PNG, JPEG, WebP, or PDF. See the ScreenshotNeo API docs.
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
import requests
r = requests.get(
"https://api.screenshotneo.com/v1/shot",
params={"access_key": "YOUR_API_KEY", "url": "https://stripe.com"},
timeout=90,
)
open("shot.webp", "wb").write(r.content)
const q = new URLSearchParams({ access_key: 'YOUR_API_KEY', url: 'https://stripe.com' });
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);
- Cookie banners are accepted and removed before capture, along with known consent platforms, newsletter popups, and chat widgets; each cleanup step can be turned off.
- Bot checks, blank pages, failed loads, timeouts, and cache hits cost nothing. Response headers report the page verdict and billing status.
- An MCP server provides
take_screenshot,get_page_info, andcapture_pdftools for Claude, Cursor, and other MCP clients. - 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 free for 1,000 screenshots a month, with no card required.
7. FAQ
Can I clear permission overrides for only one origin?
The documented method clears all permission overrides for the selected context. Reapply any overrides you still need after clearing.
Do I need to create a new browser context to reset permissions?
No. Call the method on the context you already use. A separate context is an isolation option, not a prerequisite.
Does clearing overrides close the browser context?
No. Clearing permissions and closing a context are separate operations.


