Class CdpBrowserContext
- Namespace
- PuppeteerSharp.Cdp
- Assembly
- PuppeteerSharp.dll
Supports all classes in the .NET class hierarchy and provides low-level services to derived classes. This is the ultimate base class of all .NET classes; it is the root of the type hierarchy.
public class CdpBrowserContext : BrowserContext, IBrowserContext
- Inheritance
-
CdpBrowserContext
- Implements
Methods
ClearPermissionOverridesAsync()
Clears all permission overrides for the browser context.
public override Task ClearPermissionOverridesAsync()
Returns
- Task
The task.
CloseAsync()
Closes the browser context. All the targets that belong to the browser context will be closed.
public override Task CloseAsync()
Returns
- Task
Task.
NewPageAsync()
Creates a new page.
public override Task<IPage> NewPageAsync()
Returns
OverridePermissionsAsync(string, IEnumerable<OverridePermission>)
Overrides the browser context permissions.
public override Task OverridePermissionsAsync(string origin, IEnumerable<OverridePermission> permissions)
Parameters
origin
stringThe origin to grant permissions to, e.g. "https://example.com".
permissions
IEnumerable<OverridePermission>An array of permissions to grant. All permissions that are not listed here will be automatically denied.
Returns
- Task
The task.
Examples
var context = browser.DefaultBrowserContext; await context.OverridePermissionsAsync("https://html5demos.com", new List<string> {"geolocation"});
- See Also
PagesAsync()
An array of all pages inside the browser context.
public override Task<IPage[]> PagesAsync()
Returns
- Task<IPage[]>
Task which resolves to an array of all open pages. Non visible pages, such as
"background_page"
, will not be listed here. You can find them using PageAsync().
Targets()
Gets an array of all active targets inside the browser context.
public override ITarget[] Targets()
Returns
- ITarget[]
An array of all active targets inside the browser context.