Browser

The Browser domain defines methods and events for browser managing.

Commands

Browser.setPermission

Experimental

Set permission settings for given embedding and embedded origins.

Parameters
Name Type Description
permission PermissionDescriptor Descriptor of permission to override.
setting PermissionSetting Setting of the permission.
origin (optional) string Embedding origin the permission applies to, all origins if not specified.
embeddedOrigin (optional) string Embedded origin the permission applies to. It is ignored unless the embedding origin is
present and valid. If the embedding origin is provided but the embedded origin isn't, the
embedding origin is used as the embedded origin.
browserContextId (optional) BrowserContextID Context to override. When omitted, default browser context is used.

Browser.grantPermissions

Experimental Deprecated

Grant specific permissions to the given origin and reject all others. Deprecated. Use
setPermission instead.

Parameters
Name Type Description
permissions array<PermissionType>
origin (optional) string Origin the permission applies to, all origins if not specified.
browserContextId (optional) BrowserContextID BrowserContext to override permissions. When omitted, default browser context is used.

Browser.resetPermissions

Reset all permission management for all origins.

Parameters
Name Type Description
browserContextId (optional) BrowserContextID BrowserContext to reset permissions. When omitted, default browser context is used.

Browser.setDownloadBehavior

Experimental

Set the behavior when downloading a file.

Parameters
Name Type Description
behavior string 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 (optional) BrowserContextID BrowserContext to set download behavior. When omitted, default browser context is used.
downloadPath (optional) string The default path to save downloaded files to. This is required if behavior is set to 'allow'
or 'allowAndName'.
eventsEnabled (optional) boolean Whether to emit download events (defaults to false).

Browser.cancelDownload

Experimental

Cancel a download if in progress

Parameters
Name Type Description
guid string Global unique identifier of the download.
browserContextId (optional) BrowserContextID BrowserContext to perform the action in. When omitted, default browser context is used.

Browser.close

Close browser gracefully.

Browser.crash

Experimental

Crashes browser on the main thread.

Browser.crashGpuProcess

Experimental

Crashes GPU process.

Browser.getVersion

Returns version information.

Return Object
Name Type Description
protocolVersion string Protocol version.
product string Product name.
revision string Product revision.
userAgent string User-Agent.
jsVersion string V8 version.

Browser.getBrowserCommandLine

Experimental

Returns the command line switches for the browser process if, and only if
--enable-automation is on the commandline.

Return Object
Name Type Description
arguments array<string> Commandline parameters

Browser.getHistograms

Experimental

Get Chrome histograms.

Parameters
Name Type Description
query (optional) string 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 (optional) boolean If true, retrieve delta since last delta call.
Return Object
Name Type Description
histograms array<Histogram> Histograms.

Browser.getHistogram

Experimental

Get a Chrome histogram by name.

Parameters
Name Type Description
name string Requested histogram name.
delta (optional) boolean If true, retrieve delta since last delta call.
Return Object
Name Type Description
histogram Histogram Histogram.

Browser.getWindowBounds

Experimental

Get position and size of the browser window.

Parameters
Name Type Description
windowId WindowID Browser window id.
Return Object
Name Type Description
bounds 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
Name Type Description
targetId (optional) Target.TargetID Devtools agent host id. If called as a part of the session, associated targetId is used.
Return Object
Name Type Description
windowId WindowID Browser window id.
bounds Bounds Bounds information of the window. When window state is 'minimized', the restored window
position and size are returned.

Browser.setWindowBounds

Experimental

Set position and/or size of the browser window.

Parameters
Name Type Description
windowId WindowID Browser window id.
bounds Bounds New window bounds. The 'minimized', 'maximized' and 'fullscreen' states cannot be combined
with 'left', 'top', 'width' or 'height'. Leaves unspecified fields unchanged.

Browser.setContentsSize

Experimental

Set size of the browser contents resizing browser window as necessary.

Parameters
Name Type Description
windowId WindowID Browser window id.
width (optional) integer The window contents width in DIP. Assumes current width if omitted.
Must be specified if 'height' is omitted.
height (optional) integer The 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
Name Type Description
badgeLabel (optional) string
image (optional) binary Png encoded image.

Browser.executeBrowserCommand

Experimental

Invoke custom browser commands used by telemetry.

Parameters
Name Type Description
commandId BrowserCommandId

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
Name Type Description
url string

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
Name Type Description
api PrivacySandboxAPI
coordinatorOrigin string
keyConfig string
browserContextId (optional) BrowserContextID BrowserContext to perform the action in. When omitted, default browser
context is used.

Browser.flushProfile

Experimental

Flush all in-memory profile state to disk (cookies, DOM storage, trust tokens, etc).
Used before profile backup to ensure all data is persisted to SQLite/LevelDB.

Parameters
Name Type Description
browserContextId (optional) BrowserContextID BrowserContext to flush. When omitted, default browser context is used.
Return Object
Name Type Description
cookieCount integer Number of cookies flushed to disk.
localStorageOriginCount integer Number of localStorage origins flushed.
pstCount integer Number of private state tokens flushed.

Events

Browser.downloadWillBegin

Experimental

Fired when page is about to start a download.

Parameters
Name Type Description
frameId Page.FrameId Id of the frame that caused the download to begin.
guid string Global unique identifier of the download.
url string URL of the resource being downloaded.
suggestedFilename string Suggested file name of the resource (the actual name of the file saved on disk may differ).

Browser.downloadProgress

Experimental

Fired when download makes progress. Last call has |done| == true.

Parameters
Name Type Description
guid string Global unique identifier of the download.
totalBytes number Total expected bytes to download.
receivedBytes number Total bytes received.
state string Download status.
filePath (optional) Experimental string If 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.

Types

BrowserContextID

(string) Experimental

WindowID

(integer) Experimental

WindowState

(string) Experimental

The state of the browser window.

Allowed Values
  • normal
  • minimized
  • maximized
  • fullscreen

Bounds

(object) Experimental

Browser window bounds information

Properties
Name Type Description
left (optional) integer The offset from the left edge of the screen to the window in pixels.
top (optional) integer The offset from the top edge of the screen to the window in pixels.
width (optional) integer The window width in pixels.
height (optional) integer The window height in pixels.
windowState (optional) WindowState The window state. Default to normal.

PermissionType

(string) Experimental
Allowed Values
  • ar
  • audioCapture
  • automaticFullscreen
  • backgroundFetch
  • backgroundSync
  • cameraPanTiltZoom
  • capturedSurfaceControl
  • clipboardReadWrite
  • clipboardSanitizedWrite
  • displayCapture
  • durableStorage
  • geolocation
  • handTracking
  • idleDetection
  • keyboardLock
  • localFonts
  • localNetwork
  • localNetworkAccess
  • loopbackNetwork
  • midi
  • midiSysex
  • nfc
  • notifications
  • paymentHandler
  • periodicBackgroundSync
  • pointerLock
  • protectedMediaIdentifier
  • sensors
  • smartCard
  • speakerSelection
  • storageAccess
  • topLevelStorageAccess
  • videoCapture
  • vr
  • wakeLockScreen
  • wakeLockSystem
  • webAppInstallation
  • webPrinting
  • windowManagement

PermissionSetting

(string) Experimental
Allowed Values
  • granted
  • denied
  • prompt

PermissionDescriptor

(object) Experimental

Definition of PermissionDescriptor defined in the Permissions API:
https://w3c.github.io/permissions/#dom-permissiondescriptor.

Properties
Name Type Description
name string Name of permission.
See https://cs.chromium.org/chromium/src/third_party/blink/renderer/modules/permissions/permission_descriptor.idl for valid permission names.
sysex (optional) boolean For "midi" permission, may also specify sysex control.
userVisibleOnly (optional) boolean For "push" permission, may specify userVisibleOnly.
Note that userVisibleOnly = true is the only currently supported type.
allowWithoutSanitization (optional) boolean For "clipboard" permission, may specify allowWithoutSanitization.
allowWithoutGesture (optional) boolean For "fullscreen" permission, must specify allowWithoutGesture:true.
panTiltZoom (optional) boolean For "camera" permission, may specify panTiltZoom.

BrowserCommandId

(string) Experimental

Browser command ids used by executeBrowserCommand.

Allowed Values
  • openTabSearch
  • closeTabSearch
  • openGlic

Bucket

(object) Experimental

Chrome histogram bucket.

Properties
Name Type Description
low integer Minimum value (inclusive).
high integer Maximum value (exclusive).
count integer Number of samples.

Histogram

(object) Experimental

Chrome histogram.

Properties
Name Type Description
name string Name.
sum integer Sum of sample values.
count integer Total number of samples.
buckets array<Bucket> Buckets.

PrivacySandboxAPI

(string) Experimental
Allowed Values
  • BiddingAndAuctionServices
  • TrustedKeyValue

Summary