class BrowserContext
extends EventEmitter
import { BrowserContext } from "https://deno.land/x/pptr@1.2.0/src/Browser.ts";
BrowserContexts provide a way to operate multiple independent browser sessions. When a browser is launched, it has a single BrowserContext used by default. The method Browser.newPage | Browser.newPage creates a page in the default browser context.
Examples
Example 1
Example 1
// Create a new incognito browser context
const context = await browser.createIncognitoBrowserContext();
// Create a new page inside context.
const page = await context.newPage();
// ... do stuff with page ...
await page.goto('https://example.com');
// Dispose context once it's no longer needed.
await context.close();
Constructors
Methods
clearPermissionOverrides(): Promise<void>
Clears all permission overrides for the browser context.
close(): Promise<void>
Closes the browser context. All the targets that belong to the browser context will be closed.
isIncognito(): boolean
Returns whether BrowserContext is incognito. The default browser context is the only non-incognito browser context.
overridePermissions(origin: string, permissions: string[]): Promise<void>
waitForTarget(predicate: (x: Target) => boolean, options?: { timeout?: number; }): Promise<Target>
This searches for a target in this specific browser context.