Browser Domain
The Browser domain defines methods and events for browser managing.
Methods
- 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.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.WindowID Experimental
- Browser.WindowState Experimental
Methods
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
string
Browser.getVersion #
Returns version information.
Return object
protocolVersion
string
Protocol version.
product
string
Product name.
revision
string
Product revision.
userAgent
string
User-Agent.
jsVersion
string
V8 version.
Browser.resetPermissions #
Reset all permission management for all origins.
Parameters
browserContextId
Optional
BrowserContext to reset permissions. When omitted, default browser context is used.
Browser.cancelDownload Experimental#
Cancel a download if in progress
Parameters
guid
string
Global unique identifier of the download.
browserContextId
Optional
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
string
Requested histogram name.
delta
Optional
boolean
If true, retrieve delta since last delta call.
Return object
histogram
Histogram.
Browser.getHistograms Experimental#
Get Chrome histograms.
Parameters
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
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
targetId
Optional
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 ]
origin
Optional
string
Origin the permission applies to, all origins if not specified.
browserContextId
Optional
BrowserContext to override permissions. When omitted, default browser context is used.
Browser.setDockTile Experimental#
Set dock tile details, platform-specific.
Parameters
badgeLabel
Optional
string
image
Optional
string
Png encoded image. (Encoded as a base64 string when passed over JSON)
Browser.setDownloadBehavior Experimental#
Set the behavior when downloading a file.
Parameters
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.
Allowed values: deny
, allow
, allowAndName
, default
browserContextId
Optional
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.setPermission Experimental#
Set permission settings for given origin.
Parameters
permission
Descriptor of permission to override.
setting
Setting of the permission.
origin
Optional
string
Origin the permission applies to, all origins if not specified.
browserContextId
Optional
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
string
Global unique identifier of the download.
totalBytes
number
Total expected bytes to download.
receivedBytes
number
Total bytes received.
state
string
Download status.
Allowed values: inProgress
, completed
, canceled
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
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).
Types
Browser.Bounds Experimental#
Browser window bounds information
Type: object
Properties
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
The window state. Default to normal.
Browser.BrowserCommandId Experimental#
Browser command ids used by executeBrowserCommand.
Type: string
Allowed values: openTabSearch
, closeTabSearch
Browser.Bucket Experimental#
Chrome histogram bucket.
Type: object
Properties
low
integer
Minimum value (inclusive).
high
integer
Maximum value (exclusive).
count
integer
Number of samples.
Browser.Histogram Experimental#
Chrome histogram.
Type: object
Properties
name
string
Name.
sum
integer
Sum of sample values.
count
integer
Total 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
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.
panTiltZoom
Optional
boolean
For "camera" permission, may specify panTiltZoom.
Browser.PermissionType Experimental#
Type: string
Allowed values: accessibilityEvents
, audioCapture
, backgroundSync
, backgroundFetch
, capturedSurfaceControl
, clipboardReadWrite
, clipboardSanitizedWrite
, displayCapture
, durableStorage
, flash
, geolocation
, idleDetection
, localFonts
, midi
, midiSysex
, nfc
, notifications
, paymentHandler
, periodicBackgroundSync
, protectedMediaIdentifier
, sensors
, storageAccess
, speakerSelection
, topLevelStorageAccess
, videoCapture
, videoCapturePanTiltZoom
, wakeLockScreen
, wakeLockSystem
, windowManagement
Browser.WindowState Experimental#
The state of the browser window.
Type: string
Allowed values: normal
, minimized
, maximized
, fullscreen