Browser

class Browser(cdp: CDP) : Domain

The Browser domain defines methods and events for browser managing.

Constructors

Link copied to clipboard
constructor(cdp: CDP)

Types

@Serializable
data class AddPrivacySandboxCoordinatorKeyConfigParameter(val api: Browser.PrivacySandboxAPI, val coordinatorOrigin: String, val keyConfig: String, val browserContextId: String? = null)
@Serializable
data class AddPrivacySandboxEnrollmentOverrideParameter(val url: String)
Link copied to clipboard
@Serializable
data class Bounds(val left: Int? = null, val top: Int? = null, val width: Int? = null, val height: Int? = null, val windowState: Browser.WindowState? = null)

Browser window bounds information

Link copied to clipboard

Browser command ids used by executeBrowserCommand.

Link copied to clipboard
@Serializable
data class Bucket(val low: Int, val high: Int, val count: Int)

Chrome histogram bucket.

Link copied to clipboard
@Serializable
data class CancelDownloadParameter(val guid: String, val browserContextId: String? = null)
Link copied to clipboard
@Serializable
data class DownloadProgressParameter(val guid: String, val totalBytes: Double, val receivedBytes: Double, val state: String, val filePath: String? = null)

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

Link copied to clipboard
@Serializable
data class DownloadWillBeginParameter(val frameId: String, val guid: String, val url: String, val suggestedFilename: String)

Fired when page is about to start a download.

Link copied to clipboard
@Serializable
data class ExecuteBrowserCommandParameter(val commandId: Browser.BrowserCommandId)
Link copied to clipboard
@Serializable
data class GetBrowserCommandLineReturn(val arguments: List<String>)
Link copied to clipboard
@Serializable
data class GetHistogramParameter(val name: String, val delta: Boolean? = null)
Link copied to clipboard
@Serializable
data class GetHistogramReturn(val histogram: Browser.Histogram)
Link copied to clipboard
@Serializable
data class GetHistogramsParameter(val query: String? = null, val delta: Boolean? = null)
Link copied to clipboard
@Serializable
data class GetHistogramsReturn(val histograms: List<Browser.Histogram>)
Link copied to clipboard
@Serializable
data class GetVersionReturn(val protocolVersion: String, val product: String, val revision: String, val userAgent: String, val jsVersion: String)
Link copied to clipboard
@Serializable
data class GetWindowBoundsParameter(val windowId: Int)
Link copied to clipboard
@Serializable
data class GetWindowBoundsReturn(val bounds: Browser.Bounds)
Link copied to clipboard
@Serializable
data class GetWindowForTargetParameter(val targetId: String? = null)
Link copied to clipboard
@Serializable
data class GetWindowForTargetReturn(val windowId: Int, val bounds: Browser.Bounds)
Link copied to clipboard
@Serializable
data class GrantPermissionsParameter(val permissions: List<Browser.PermissionType>, val origin: String? = null, val browserContextId: String? = null)
Link copied to clipboard
@Serializable
data class Histogram(val name: String, val sum: Int, val count: Int, val buckets: List<Browser.Bucket>)

Chrome histogram.

Link copied to clipboard
@Serializable
data class PermissionDescriptor(val name: String, val sysex: Boolean? = null, val userVisibleOnly: Boolean? = null, val allowWithoutSanitization: Boolean? = null, val allowWithoutGesture: Boolean? = null, val panTiltZoom: Boolean? = null)

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

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
@Serializable
data class ResetPermissionsParameter(val browserContextId: String? = null)
Link copied to clipboard
@Serializable
data class SetDockTileParameter(val badgeLabel: String? = null, val image: String? = null)
Link copied to clipboard
@Serializable
data class SetDownloadBehaviorParameter(val behavior: String, val browserContextId: String? = null, val downloadPath: String? = null, val eventsEnabled: Boolean? = null)
Link copied to clipboard
@Serializable
data class SetPermissionParameter(val permission: Browser.PermissionDescriptor, val setting: Browser.PermissionSetting, val origin: String? = null, val browserContextId: String? = null)
Link copied to clipboard
@Serializable
data class SetWindowBoundsParameter(val windowId: Int, val bounds: Browser.Bounds)
Link copied to clipboard
@Serializable
enum WindowState : Enum<Browser.WindowState>

The state of the browser window.

Properties

Link copied to clipboard

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

Link copied to clipboard

Fired when page is about to start a download.

Functions

Link copied to clipboard
suspend fun addPrivacySandboxCoordinatorKeyConfig(api: Browser.PrivacySandboxAPI, coordinatorOrigin: String, keyConfig: String, browserContextId: String? = null)

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.

Link copied to clipboard

Allows a site to use privacy sandbox features that require enrollment without the site actually being enrolled. Only supported on page targets.

Link copied to clipboard
suspend fun cancelDownload(args: Browser.CancelDownloadParameter, mode: CommandMode = CommandMode.DEFAULT)
suspend fun cancelDownload(guid: String, browserContextId: String? = null)

Cancel a download if in progress

Link copied to clipboard
suspend fun close(mode: CommandMode = CommandMode.DEFAULT)

Close browser gracefully.

Link copied to clipboard
suspend fun crash(mode: CommandMode = CommandMode.DEFAULT)

Crashes browser on the main thread.

Link copied to clipboard
suspend fun crashGpuProcess(mode: CommandMode = CommandMode.DEFAULT)

Crashes GPU process.

Link copied to clipboard
suspend fun executeBrowserCommand(args: Browser.ExecuteBrowserCommandParameter, mode: CommandMode = CommandMode.DEFAULT)

Invoke custom browser commands used by telemetry.

Link copied to clipboard

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

Link copied to clipboard
suspend fun getHistogram(args: Browser.GetHistogramParameter, mode: CommandMode = CommandMode.DEFAULT): Browser.GetHistogramReturn
suspend fun getHistogram(name: String, delta: Boolean? = null): Browser.GetHistogramReturn

Get a Chrome histogram by name.

Link copied to clipboard
suspend fun getHistograms(query: String? = null, delta: Boolean? = null): Browser.GetHistogramsReturn

Get Chrome histograms.

Link copied to clipboard
suspend fun getVersion(mode: CommandMode = CommandMode.DEFAULT): Browser.GetVersionReturn

Returns version information.

Link copied to clipboard

Get position and size of the browser window.

Link copied to clipboard

Get the browser window that contains the devtools target.

Link copied to clipboard
suspend fun grantPermissions(args: Browser.GrantPermissionsParameter, mode: CommandMode = CommandMode.DEFAULT)
suspend fun grantPermissions(permissions: List<Browser.PermissionType>, origin: String? = null, browserContextId: String? = null)

Grant specific permissions to the given origin and reject all others.

Link copied to clipboard
suspend fun resetPermissions(browserContextId: String? = null)
suspend fun resetPermissions(args: Browser.ResetPermissionsParameter, mode: CommandMode = CommandMode.DEFAULT)

Reset all permission management for all origins.

Link copied to clipboard
suspend fun setDockTile(args: Browser.SetDockTileParameter, mode: CommandMode = CommandMode.DEFAULT)
suspend fun setDockTile(badgeLabel: String? = null, image: String? = null)

Set dock tile details, platform-specific.

Link copied to clipboard
suspend fun setDownloadBehavior(args: Browser.SetDownloadBehaviorParameter, mode: CommandMode = CommandMode.DEFAULT)
suspend fun setDownloadBehavior(behavior: String, browserContextId: String? = null, downloadPath: String? = null, eventsEnabled: Boolean? = null)

Set the behavior when downloading a file.

Link copied to clipboard
suspend fun setPermission(args: Browser.SetPermissionParameter, mode: CommandMode = CommandMode.DEFAULT)
suspend fun setPermission(permission: Browser.PermissionDescriptor, setting: Browser.PermissionSetting, origin: String? = null, browserContextId: String? = null)

Set permission settings for given origin.

Link copied to clipboard
suspend fun setWindowBounds(args: Browser.SetWindowBoundsParameter, mode: CommandMode = CommandMode.DEFAULT)
suspend fun setWindowBounds(windowId: Int, bounds: Browser.Bounds)

Set position and/or size of the browser window.