October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsPC HealthRecommendedCrashes, freezes, slowdowns? Check your PC nowSpot repairable issues before they interrupt work.Check PCOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
World desk4 min

How to Set Permissions in a Puppeteer BrowserContext

Puppeteer permissions are configured on a BrowserContext for an origin. Here’s how the stable override API differs from the newer Next setPermission method.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Set browser permissions on a Puppeteer BrowserContext, scoped to the origin your test visits—not on the Page. In the stable Puppeteer 25.12.0 API, context.overridePermissions(origin, permissions) is documented but deprecated; the current Next API documents context.setPermission(origin, ...permissions) with explicit permission states. Use the method supported by your installed Puppeteer version, and clear overrides when the test is finished.

Choose the permission API for your Puppeteer version

The stable BrowserContext API reference identifies overridePermissions as deprecated in favor of setPermission. However, the current Next reference documents the newer method, and that alone does not establish that it is available in every stable release. Check the API reference for the Puppeteer version installed in your project before changing code.

As an Amazon Associate I earn from qualifying purchases.

Method Shape What the documentation establishes
overridePermissions(origin, permissions) Origin string and an array of permission names Documented in stable Puppeteer 25.12.0 and marked deprecated. Listed permissions are granted; omitted permissions are automatically denied for that origin.
setPermission(origin, ...permissions) Origin string or '*', followed by permission descriptors paired with states Documented in the current Next API. Supports explicit states; its documentation does not establish the omitted-permission behavior of overridePermissions.

The stable reference and Next reference describe different release contexts. Do not assume their signatures or behavior are interchangeable: verify the installed release’s reference before adopting setPermission.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Grant a permission with the stable API

This example uses the stable API reference’s legacy override method. It grants geolocation for https://example.com, creates a page in the configured context, and clears that context’s permission overrides afterward.

#1 Best Overall
Yubico - Security Key C NFC - Basic Compatibility - Multi-Factor authentication (MFA) Security Key and passkey, Connect via USB-C or NFC, FIDO Certified
  • POWERFUL SECURITY KEY: The Security Key C NFC is the essential physical passkey for protecting your digital life from phishing attacks. It ensures only you can access your accounts.
  • WORKS WITH 1000+ ACCOUNTS: Compatible with Google, Microsoft, and Apple. A single Security Key C NFC secures 100 of your favorite accounts, including email, password managers, and more.
  • FAST & CONVENIENT LOGIN: Plug in your Security Key C NFC via USB-C and tap it, or tap it against your phone (NFC) to authenticate. No batteries, no internet connection, and no extra fees required.
  • TRUSTED PASSKEY TECHNOLOGY: Uses the latest passkey standards (FIDO2/WebAuthn & FIDO U2F) but does not support One-Time Passwords. For complex needs, check out the YubiKey 5 Series.
  • BUILT TO LAST: Made from tough, waterproof, and crush-resistant materials. Manufactured in Sweden and programmed in the USA with the highest security standards.
const puppeteer = require('puppeteer');

(async () => {
  const browser = await puppeteer.launch();
  const context = browser.defaultBrowserContext();

  try {
    await context.overridePermissions('https://example.com', ['geolocation']);
    const page = await context.newPage();
    await page.goto('https://example.com');

    // Exercise the page feature that needs geolocation here.
  } finally {
    await context.clearPermissionOverrides();
    await browser.close();
  }
})();

With this method, the permission list is a grant list: permissions omitted from the array are automatically denied for that origin. Use the exact origin relevant to the page, including its scheme and host.

Set an explicit permission state in the Next API

The current Next API uses a descriptor and a state instead of an array of permission names:

Rank #2
Yubico - YubiKey 5 NFC - Multi-Factor authentication (MFA) Security Key and passkey, Connect via USB-A or NFC, FIDO Certified - Protect Your Online Accounts
  • POWERFUL SECURITY KEY: The YubiKey 5 NFC is the most versatile physical passkey, protecting your digital life from phishing attacks. It ensures only you can access your accounts
  • WORKS WITH 1000+ ACCOUNTS: Compatible with popular accounts like Google, Microsoft, and Apple. A single YubiKey 5 NFC secures 100+ of your favorite accounts, including email, password managers, and more
  • FAST & CONVENIENT LOGIN: Plug in your YubiKey 5 NFC via USB and tap it, or tap it against your phone (NFC), to authenticate. No batteries, no internet connection, and no extra fees required
  • MOST SECURE PASSKEY: Supports FIDO2/WebAuthn, FIDO U2F, Yubico OTP, OATH-TOTP/HOTP, Smart card (PIV), and OpenPGP. That means it’s versatile, working almost anywhere you need it
  • PRIMARY & SPARE KEYS: Just like having a spare house key, we recommend buying two YubiKeys - one for daily use and one as a spare. That way you’ll never get locked out of your accounts
await context.setPermission('https://example.com', {
  permission: { name: 'geolocation' },
  state: 'granted',
});

The documented signature accepts an origin string or '*' and a variable number of permission/state objects. Because this is the Next documentation, confirm that your installed version supports this method and shape before using it. Do not infer that permissions you leave out are denied; that behavior is stated for overridePermissions, not for setPermission.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Use a dedicated context when isolation matters

You can configure the default browser context, as in the stable example, or create a separate context for a test. Puppeteer documents that separate BrowserContexts do not share cookies or cache. Treat permission configuration as context-scoped, set it before exercising the page feature, and close the context or clear its overrides as part of cleanup.

Rank #3
Yubico - YubiKey 5C NFC - Multi-Factor authentication (MFA) Security Key and passkey, Connect via USB-C or NFC, FIDO Certified - Protect Your Online Accounts
  • POWERFUL SECURITY KEY: The YubiKey 5C NFC is the most versatile physical passkey, protecting your digital life from phishing attacks. It ensures only you can access your accounts
  • WORKS WITH 1000+ ACCOUNTS: Compatible with popular accounts like Google, Microsoft, and Apple. A single YubiKey 5C NFC secures 100+ of your favorite accounts, including email, password managers, and more
  • FAST & CONVENIENT LOGIN: Plug in your YubiKey 5C NFC via USB and tap it, or tap it against your phone (NFC), to authenticate. No batteries, no internet connection, and no extra fees required
  • MOST SECURE PASSKEY: Supports FIDO2/WebAuthn, FIDO U2F, Yubico OTP, OATH-TOTP/HOTP, Smart card (PIV), and OpenPGP. That means it’s versatile, working almost anywhere you need it
  • PRIMARY & SPARE KEYS: Just like having a spare house key, we recommend buying two YubiKeys - one for daily use and one as a spare. That way you’ll never get locked out of your accounts

The documented cleanup method, clearPermissionOverrides(), clears all permission overrides for that context; it is not described as an origin-specific reset. Avoid calling it mid-test if another page in the same context depends on an override.

Grant geolocation or clipboard access

Geolocation

Puppeteer’s guide demonstrates setting geolocation permission for an origin. With the stable API, use overridePermissions(origin, ['geolocation']); with the Next API, use a descriptor for geolocation and set its state to 'granted', if supported by your installed version.

Rank #4
Yubico - Security Key NFC - Basic Compatibility - Multi-Factor Authentication (MFA) Key, Connect via USB-A or NFC, FIDO Certified
  • POWERFUL SECURITY KEY: The Security Key NFC is the essential physical passkey for protecting your digital life from phishing attacks. It ensures only you can access your accounts.
  • WORKS WITH 1000+ ACCOUNTS: Compatible with Google, Microsoft, and Apple. A single Security Key NFC secures 100 of your favorite accounts, including email, password managers, and more.
  • FAST & CONVENIENT LOGIN: Plug in your Security Key NFC via USB-A and tap it, or tap it against your phone (NFC) to authenticate. No batteries, no internet connection, and no extra fees required.
  • TRUSTED PASSKEY TECHNOLOGY: Uses the latest passkey standards (FIDO2/WebAuthn & FIDO U2F) but does not support One-Time Passwords. For complex needs, check out the YubiKey 5 Series.
  • BUILT TO LAST: Made from tough, waterproof, and crush-resistant materials. Manufactured in Sweden and programmed in the USA with the highest security standards.

Clipboard

Puppeteer’s Mouse API documentation discusses granting clipboard-read and clipboard-write to access the clipboard. The legacy Permission type also lists these names, along with notifications, camera, and microphone, but that type page is marked obsolete. Treat it as context for older examples, not a current, complete compatibility list.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Official documentation does not establish a complete browser-by-browser compatibility matrix for all permission descriptors. Check support for the specific descriptor, Puppeteer release, and browser you run.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Troubleshoot permission failures

  • The permission method is missing: You may be using setPermission with a release whose installed API does not document it. Check that release’s BrowserContext reference; use its supported method rather than assuming the Next API applies.
  • The page still shows a permission prompt or behaves as if access is denied: Confirm that the override was applied to the BrowserContext used to create or access the page, and that the origin matches the page’s scheme and host.
  • A different permission is unexpectedly denied: With overridePermissions, omitted permissions are automatically denied for the origin. Include every permission the test needs.
  • A granted permission has no effect: The documentation cited here does not provide a full descriptor/browser support matrix. Verify that the exact browser and permission descriptor support the behavior you are testing.
  • Permission state leaks into later test steps: clearPermissionOverrides() clears overrides across the whole context. Use it at an appropriate cleanup boundary, or isolate tests in separate contexts.

Or skip the browser setup

If your goal is to capture a page rather than test browser permission behavior, ScreenshotNeo can return a website screenshot with one GET request. Its capture flow accepts cookie or consent banners as a visitor and removes more than 60 known consent platforms, newsletter popups, and chat widgets before the shot; each step can be turned off. Bot checks and CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed, and response headers report the page verdict and billing status. ScreenshotNeo also provides an MCP server with take_screenshot, get_page_info, and capture_pdf tools for AI agents.

See the ScreenshotNeo documentation for options. For example, this cURL request saves a screenshot of Stripe 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

The free plan includes 1,000 screenshots a month with no card; paid plans start at $5 for 3,000. Sign up for free.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

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.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Outdated Drivers Are Slowing You DownFree scan - exact matches
Windows Errors? Fix Them Before They SpreadFree repair scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.