Browser Domain
The Browser domain defines methods and events for browser managing.
Methods
- Browser.addPrivacySandboxCoordinatorKeyConfig
- Browser.addPrivacySandboxEnrollmentOverride
- Browser.close
- Browser.getVersion
- Browser.resetPermissions
- Browser.cancelDownload Experimental
- Browser.crash Experimental
- Browser.crashGpuProcess Experimental
- Browser.executeBrowserCommand Experimental
- Browser.getBrowserCommandLine Experimental
- Browser.getHistogram Experimental
- Browser.getHistograms Experimental
- Browser.getWindowBounds Experimental
- Browser.getWindowForTarget Experimental
- Browser.grantPermissions Experimental
- Browser.setContentsSize Experimental
- Browser.setDockTile Experimental
- Browser.setDownloadBehavior Experimental
- Browser.setPermission Experimental
- Browser.setWindowBounds Experimental
Events
- Browser.downloadProgress Experimental
- Browser.downloadWillBegin Experimental
Types
- Browser.Bounds Experimental
- Browser.BrowserCommandId Experimental
- Browser.BrowserContextID Experimental
- Browser.Bucket Experimental
- Browser.Histogram Experimental
- Browser.PermissionDescriptor Experimental
- Browser.PermissionSetting Experimental
- Browser.PermissionType Experimental
- Browser.PrivacySandboxAPI Experimental
- Browser.WindowID Experimental
- Browser.WindowState Experimental
Methods
Browser.addPrivacySandboxCoordinatorKeyConfig #
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.
Parameters
coordinatorOrigin stringkeyConfig stringbrowserContextIdOptional
BrowserContext to perform the action in. When omitted, default browser context is used.
Browser.addPrivacySandboxEnrollmentOverride #
Allows a site to use privacy sandbox features that require enrollment without the site actually being enrolled. Only supported on page targets.
Parameters
url stringBrowser.getVersion #
Returns version information.
Return object
protocolVersion stringProtocol version.
product stringProduct name.
revision stringProduct revision.
userAgent stringUser-Agent.
jsVersion stringV8 version.
Browser.resetPermissions #
Reset all permission management for all origins.
Parameters
browserContextIdOptional
BrowserContext to reset permissions. When omitted, default browser context is used.
Browser.cancelDownload Experimental#
Cancel a download if in progress
Parameters
guid stringGlobal unique identifier of the download.
browserContextIdOptional
BrowserContext to perform the action in. When omitted, default browser context is used.
Browser.executeBrowserCommand Experimental#
Invoke custom browser commands used by telemetry.
Parameters
commandId Browser.getBrowserCommandLine Experimental#
Returns the command line switches for the browser process if, and only if --enable-automation is on the commandline.
Return object
arguments array[ string ]Commandline parameters
Browser.getHistogram Experimental#
Get a Chrome histogram by name.
Parameters
name stringRequested histogram name.
deltaOptional
booleanIf true, retrieve delta since last delta call.
Return object
histogram Histogram.
Browser.getHistograms Experimental#
Get Chrome histograms.
Parameters
queryOptional
stringRequested substring in name. Only histograms which have query as a substring in their name are extracted. An empty or absent query returns all histograms.
deltaOptional
booleanIf true, retrieve delta since last delta call.
Return object
histograms array[ Histogram ]Histograms.
Browser.getWindowBounds Experimental#
Get position and size of the browser window.
Parameters
windowId Browser window id.
Return object
bounds Bounds information of the window. When window state is 'minimized', the restored window position and size are returned.
Browser.getWindowForTarget Experimental#
Get the browser window that contains the devtools target.
Parameters
targetIdOptional
Devtools agent host id. If called as a part of the session, associated targetId is used.
Return object
windowId Browser window id.
bounds Bounds information of the window. When window state is 'minimized', the restored window position and size are returned.
Browser.grantPermissions Experimental#
Grant specific permissions to the given origin and reject all others.
Parameters
permissions array[ PermissionType ]originOptional
stringOrigin the permission applies to, all origins if not specified.
browserContextIdOptional
BrowserContext to override permissions. When omitted, default browser context is used.
Browser.setContentsSize Experimental#
Set size of the browser contents resizing browser window as necessary.
Parameters
windowId Browser window id.
widthOptional
integerThe window contents width in DIP. Assumes current width if omitted. Must be specified if 'height' is omitted.
heightOptional
integerThe window contents height in DIP. Assumes current height if omitted. Must be specified if 'width' is omitted.
Browser.setDockTile Experimental#
Set dock tile details, platform-specific.
Parameters
badgeLabelOptional
stringimageOptional
stringPng encoded image. (Encoded as a base64 string when passed over JSON)
Browser.setDownloadBehavior Experimental#
Set the behavior when downloading a file.
Parameters
behavior stringWhether 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.
Allowed values: deny, allow, allowAndName, default
browserContextIdOptional
BrowserContext to set download behavior. When omitted, default browser context is used.
downloadPathOptional
stringThe default path to save downloaded files to. This is required if behavior is set to 'allow' or 'allowAndName'.
eventsEnabledOptional
booleanWhether to emit download events (defaults to false).
Browser.setPermission Experimental#
Set permission settings for given requesting and embedding origins.
Parameters
permission Descriptor of permission to override.
setting Setting of the permission.
originOptional
stringRequesting origin the permission applies to, all origins if not specified.
embeddingOriginOptional
stringEmbedding origin the permission applies to. It is ignored unless the requesting origin is present and valid. If the requesting origin is provided but the embedding origin isn't, the requesting origin is used as the embedding origin.
browserContextIdOptional
Context to override. When omitted, default browser context is used.
Browser.setWindowBounds Experimental#
Set position and/or size of the browser window.
Parameters
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.
Events
Browser.downloadProgress Experimental#
Fired when download makes progress. Last call has |done| == true.
Parameters
guid stringGlobal unique identifier of the download.
totalBytes numberTotal expected bytes to download.
receivedBytes numberTotal bytes received.
state stringDownload status.
Allowed values: inProgress, completed, canceled
filePathOptional
stringIf download is "completed", provides the path of the downloaded file. Depending on the platform, it is not guaranteed to be set, nor the file is guaranteed to exist.
Browser.downloadWillBegin Experimental#
Fired when page is about to start a download.
Parameters
frameId Id of the frame that caused the download to begin.
guid stringGlobal unique identifier of the download.
url stringURL of the resource being downloaded.
suggestedFilename stringSuggested file name of the resource (the actual name of the file saved on disk may differ).
Types
Browser.Bounds Experimental#
Browser window bounds information
Type: object
Properties
leftOptional
integerThe offset from the left edge of the screen to the window in pixels.
topOptional
integerThe offset from the top edge of the screen to the window in pixels.
widthOptional
integerThe window width in pixels.
heightOptional
integerThe window height in pixels.
windowStateOptional
The window state. Default to normal.
Browser.BrowserCommandId Experimental#
Browser command ids used by executeBrowserCommand.
Type: string
Allowed values: openTabSearch, closeTabSearch, openGlic
Browser.Bucket Experimental#
Chrome histogram bucket.
Type: object
Properties
low integerMinimum value (inclusive).
high integerMaximum value (exclusive).
count integerNumber of samples.
Browser.Histogram Experimental#
Chrome histogram.
Type: object
Properties
name stringName.
sum integerSum of sample values.
count integerTotal number of samples.
buckets array[ Bucket ]Buckets.
Browser.PermissionDescriptor Experimental#
Definition of PermissionDescriptor defined in the Permissions API: https://w3c.github.io/permissions/#dom-permissiondescriptor.
Type: object
Properties
name stringName of permission. See https://cs.chromium.org/chromium/src/third_party/blink/renderer/modules/permissions/permission_descriptor.idl for valid permission names.
sysexOptional
booleanFor "midi" permission, may also specify sysex control.
userVisibleOnlyOptional
booleanFor "push" permission, may specify userVisibleOnly. Note that userVisibleOnly = true is the only currently supported type.
allowWithoutSanitizationOptional
booleanFor "clipboard" permission, may specify allowWithoutSanitization.
allowWithoutGestureOptional
booleanFor "fullscreen" permission, must specify allowWithoutGesture:true.
panTiltZoomOptional
booleanFor "camera" permission, may specify panTiltZoom.
Browser.PermissionType Experimental#
Type: string
Allowed values: ar, audioCapture, automaticFullscreen, backgroundFetch, backgroundSync, cameraPanTiltZoom, capturedSurfaceControl, clipboardReadWrite, clipboardSanitizedWrite, displayCapture, durableStorage, geolocation, handTracking, idleDetection, keyboardLock, localFonts, localNetworkAccess, midi, midiSysex, nfc, notifications, paymentHandler, periodicBackgroundSync, pointerLock, protectedMediaIdentifier, sensors, smartCard, speakerSelection, storageAccess, topLevelStorageAccess, videoCapture, vr, wakeLockScreen, wakeLockSystem, webAppInstallation, webPrinting, windowManagement
Browser.PrivacySandboxAPI Experimental#
Type: string
Allowed values: BiddingAndAuctionServices, TrustedKeyValue
Browser.WindowState Experimental#
The state of the browser window.
Type: string
Allowed values: normal, minimized, maximized, fullscreen