browser
Returns the browser this context belongs to. Upstream docsReturn value
serviceWorkers
Returns all service workers in the context.Service workers are only available on Chromium-based browsers.
Return value
newCDPSession
Returns the newly created CDP session attached to the given page.CDP Sessions are only supported on Chromium-based browsers.
Target page to create CDP session for.
Return value
grantPermissions
Grants specified permissions to the browser context.Only grants corresponding permissions to the given origin if specified.
clearPermissions
Clears all permission overrides for the browser context. Upstream docsaddInitScript
Adds a script which would be evaluated in one of the following scenarios: whenever a page is created in the context or navigated.The script is evaluated before any page script. Use when you want to inject JavaScript before the page loads.
exposeBinding
Adds a function called name on the window object of every frame in every page in the context.When called, the function executes callback and returns a Promise which resolves to the return value of callback. The first argument of the callback function contains information about the caller.
route
Routing provides the capability to modify network requests that are made by any page in the browser context.Once routing is enabled, every request matching the url pattern will stall unless it is continued, fulfilled, or aborted.
routeFromHAR
If specified, network requests that are made in the context will be served from the HAR file.Read more about Replaying from HAR.
Path to a HAR file with recorded network data.
unroute
Removes a route created with browserContext.route(). When handler is not specified, removes all routes for the url. Upstream docsunrouteAll
Removes all routes created with browserContext.route() and browserContext.routeFromHAR(). Upstream docssetExtraHTTPHeaders
Sets extra HTTP headers that will be sent with every request in the context.These headers are merged with page-specific extra HTTP headers set with page.setExtraHTTPHeaders(). If page overrides a particular header, page-specific header value will be used instead of the browser context header value.
setHTTPCredentials
Sets HTTP credentials for HTTP authentication.Deprecated: Browsers may cache credentials after successful authentication. Create a new browser context instead.
setOffline
Sets whether to emulate network being offline for the browser context. Upstream docssetGeolocation
Sets the contexts geolocation. Passing null clears geolocation.Requires the geolocation permission to be granted.
setDefaultNavigationTimeout
Sets the default maximum navigation timeout for this context.This setting will change the default maximum navigation time for page.goto(), page.reload(), page.goBack(), page.goForward(), page.waitForNavigation().
setDefaultTimeout
Sets the default maximum time for all methods accepting timeout option. Upstream docsstorageState
Returns storage state for this browser context.Contains current cookies and local storage snapshot.
Return value
routeWebSocket
Allows modifying WebSocket connections made by pages in the context.Only WebSockets created after this method was called will be routed. It is recommended to call this method before creating any pages.
URL pattern to match WebSocket connections.
Handler function to route the WebSocket.
backgroundPages
Returns all background pages in the context.Deprecated. Background pages are only supported on Chromium-based browsers.
Return value

