BrowserApi class
The Browser domain defines methods and events for browser managing.
Constructors
- BrowserApi(Client _client)
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
-
onDownloadProgress
→ Stream<
DownloadProgressEvent> -
Fired when download makes progress. Last call has |done| == true.
no setter
-
onDownloadWillBegin
→ Stream<
DownloadWillBeginEvent> -
Fired when page is about to start a download.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
addPrivacySandboxCoordinatorKeyConfig(
PrivacySandboxAPI api, String coordinatorOrigin, String keyConfig, {BrowserContextID? browserContextId}) → Future< void> -
Configures encryption keys used with a given privacy sandbox API to talk
to a trusted coordinator. Since this is intended for test automation only,
coordinatorOrigin must be a .test domain. No existing coordinator
configuration for the origin may exist.
browserContextIdBrowserContext to perform the action in. When omitted, default browser context is used. -
addPrivacySandboxEnrollmentOverride(
String url) → Future< void> - Allows a site to use privacy sandbox features that require enrollment without the site actually being enrolled. Only supported on page targets.
-
cancelDownload(
String guid, {BrowserContextID? browserContextId}) → Future< void> -
Cancel a download if in progress
guidGlobal unique identifier of the download.browserContextIdBrowserContext to perform the action in. When omitted, default browser context is used. -
close(
) → Future< void> - Close browser gracefully.
-
crash(
) → Future< void> - Crashes browser on the main thread.
-
crashGpuProcess(
) → Future< void> - Crashes GPU process.
-
executeBrowserCommand(
BrowserCommandId commandId) → Future< void> - Invoke custom browser commands used by telemetry.
-
getBrowserCommandLine(
) → Future< List< String> > - Returns the command line switches for the browser process if, and only if --enable-automation is on the commandline. Returns: Commandline parameters
-
getHistogram(
String name, {bool? delta}) → Future< Histogram> -
Get a Chrome histogram by name.
nameRequested histogram name.deltaIf true, retrieve delta since last delta call. Returns: Histogram. -
getHistograms(
{String? query, bool? delta}) → Future< List< Histogram> > -
Get Chrome histograms.
queryRequested substring in name. Only histograms which have query as a substring in their name are extracted. An empty or absent query returns all histograms.deltaIf true, retrieve delta since last delta call. Returns: Histograms. -
getVersion(
) → Future< GetVersionResult> - Returns version information.
-
getWindowBounds(
WindowID windowId) → Future< Bounds> -
Get position and size of the browser window.
windowIdBrowser window id. Returns: Bounds information of the window. When window state is 'minimized', the restored window position and size are returned. -
getWindowForTarget(
{TargetID? targetId}) → Future< GetWindowForTargetResult> -
Get the browser window that contains the devtools target.
targetIdDevtools agent host id. If called as a part of the session, associated targetId is used. -
grantPermissions(
List< PermissionType> permissions, {String? origin, BrowserContextID? browserContextId}) → Future<void> -
Grant specific permissions to the given origin and reject all others.
originOrigin the permission applies to, all origins if not specified.browserContextIdBrowserContext to override permissions. When omitted, default browser context is used. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
resetPermissions(
{BrowserContextID? browserContextId}) → Future< void> -
Reset all permission management for all origins.
browserContextIdBrowserContext to reset permissions. When omitted, default browser context is used. -
setContentsSize(
WindowID windowId, {int? width, int? height}) → Future< void> -
Set size of the browser contents resizing browser window as necessary.
windowIdBrowser window id.widthThe window contents width in DIP. Assumes current width if omitted. Must be specified if 'height' is omitted.heightThe window contents height in DIP. Assumes current height if omitted. Must be specified if 'width' is omitted. -
setDockTile(
{String? badgeLabel, String? image}) → Future< void> -
Set dock tile details, platform-specific.
imagePng encoded image. -
setDownloadBehavior(
String behavior, {BrowserContextID? browserContextId, String? downloadPath, bool? eventsEnabled}) → Future< void> -
Set the behavior when downloading a file.
behaviorWhether to allow all or deny all download requests, or use default Chrome behavior if available (otherwise deny). |allowAndName| allows download and names files according to their download guids.browserContextIdBrowserContext to set download behavior. When omitted, default browser context is used.downloadPathThe default path to save downloaded files to. This is required if behavior is set to 'allow' or 'allowAndName'.eventsEnabledWhether to emit download events (defaults to false). -
setPermission(
PermissionDescriptor permission, PermissionSetting setting, {String? origin, BrowserContextID? browserContextId}) → Future< void> -
Set permission settings for given origin.
permissionDescriptor of permission to override.settingSetting of the permission.originOrigin the permission applies to, all origins if not specified.browserContextIdContext to override. When omitted, default browser context is used. -
setWindowBounds(
WindowID windowId, Bounds bounds) → Future< void> -
Set position and/or size of the browser window.
windowIdBrowser window id.boundsNew window bounds. The 'minimized', 'maximized' and 'fullscreen' states cannot be combined with 'left', 'top', 'width' or 'height'. Leaves unspecified fields unchanged. -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited