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

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 guid Global unique identifier of the download. browserContextId BrowserContext 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. name Requested histogram name. delta If true, retrieve delta since last delta call. Returns: Histogram.
getHistograms({String? query, bool? delta}) Future<List<Histogram>>
Get Chrome histograms. query Requested substring in name. Only histograms which have query as a substring in their name are extracted. An empty or absent query returns all histograms. delta If 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. windowId Browser 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. targetId Devtools 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. origin Origin the permission applies to, all origins if not specified. browserContextId BrowserContext 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. browserContextId BrowserContext to reset permissions. When omitted, default browser context is used.
setDockTile({String? badgeLabel, String? image}) Future<void>
Set dock tile details, platform-specific. image Png encoded image.
setDownloadBehavior(String behavior, {BrowserContextID? browserContextId, String? downloadPath, bool? eventsEnabled}) Future<void>
Set the behavior when downloading a file. behavior Whether 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. browserContextId BrowserContext to set download behavior. When omitted, default browser context is used. downloadPath The default path to save downloaded files to. This is required if behavior is set to 'allow' or 'allowAndName'. eventsEnabled Whether to emit download events (defaults to false).
setPermission(PermissionDescriptor permission, PermissionSetting setting, {String? origin, BrowserContextID? browserContextId}) Future<void>
Set permission settings for given origin. permission Descriptor of permission to override. setting Setting of the permission. origin Origin the permission applies to, all origins if not specified. browserContextId Context 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. windowId Browser window id. bounds New 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