Back to Puppeteer

BrowserContext.setPermission() method

docs/api/puppeteer.browsercontext.setpermission.md

19.2.2814 B
Original Source

BrowserContext.setPermission() method

Sets the permission for a specific origin.

Signature

typescript
class BrowserContext {
  abstract setPermission(
    origin: string | '*',
    ...permissions: Array<{
      permission: PermissionDescriptor;
      state: PermissionState;
    }>
  ): Promise<void>;
}

Parameters

<table><thead><tr><th>

Parameter

</th><th>

Type

</th><th>

Description

</th></tr></thead> <tbody><tr><td>

origin

</td><td>

string | '*'

</td><td>

The origin to set the permission for.

</td></tr> <tr><td>

permissions

</td><td>

Array<{ permission: PermissionDescriptor; state: PermissionState; }>

</td><td> </td></tr> </tbody></table>

Returns:

Promise<void>