CDPotion.Domain.Browser (cdpotion v0.1.4)

Summary

Types

Browser window bounds information

Browser command ids used by executeBrowserCommand.

description not provided :(

Chrome histogram bucket.

Chrome histogram.

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

description not provided :(

description not provided :(

description not provided :(

The state of the browser window.

Functions

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

Cancel a download if in progress

Close browser gracefully.

Crashes browser on the main thread.

Crashes GPU process.

Invoke custom browser commands used by telemetry.

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

Get a Chrome histogram by name.

Returns version information.

Get position and size of the browser window.

Get the browser window that contains the devtools target.

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

Reset all permission management for all origins.

Set dock tile details, platform-specific.

Set position and/or size of the browser window.

Types

@type bounds() :: %{
  height: integer() | nil,
  left: integer() | nil,
  top: integer() | nil,
  width: integer() | nil,
  windowState: window_state() | nil
}

Browser window bounds information

Link to this type

browser_command_id()

@type browser_command_id() :: :openTabSearch | :closeTabSearch

Browser command ids used by executeBrowserCommand.

Link to this type

browser_context_id()

@type browser_context_id() :: String.t()

description not provided :(

@type bucket() :: %{count: integer(), high: integer(), low: integer()}

Chrome histogram bucket.

@type histogram() :: %{
  buckets: [bucket()],
  count: integer(),
  name: String.t(),
  sum: integer()
}

Chrome histogram.

Link to this type

permission_descriptor()

@type permission_descriptor() :: %{
  allowWithoutSanitization: boolean() | nil,
  name: String.t(),
  panTiltZoom: boolean() | nil,
  sysex: boolean() | nil,
  userVisibleOnly: boolean() | nil
}

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

Link to this type

permission_setting()

@type permission_setting() :: :granted | :denied | :prompt

description not provided :(

Link to this type

permission_type()

@type permission_type() ::
  :accessibilityEvents
  | :audioCapture
  | :backgroundSync
  | :backgroundFetch
  | :clipboardReadWrite
  | :clipboardSanitizedWrite
  | :displayCapture
  | :durableStorage
  | :flash
  | :geolocation
  | :idleDetection
  | :localFonts
  | :midi
  | :midiSysex
  | :nfc
  | :notifications
  | :paymentHandler
  | :periodicBackgroundSync
  | :protectedMediaIdentifier
  | :sensors
  | :storageAccess
  | :topLevelStorageAccess
  | :videoCapture
  | :videoCapturePanTiltZoom
  | :wakeLockScreen
  | :wakeLockSystem
  | :windowManagement

description not provided :(

@type window_id() :: integer()

description not provided :(

Link to this type

window_state()

@type window_state() :: :normal | :minimized | :maximized | :fullscreen

The state of the browser window.

Functions

Link to this function

add_privacy_sandbox_enrollment_override(url)

@spec add_privacy_sandbox_enrollment_override(String.t()) :: {String.t(), map()}

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

Parameters:

  • (Required) url: description not provided :(
Link to this function

cancel_download(guid, browser_context_id \\ nil)

@spec cancel_download(String.t(), browser_context_id()) :: {String.t(), map()}

Cancel a download if in progress

Parameters:

  • (Required) guid: Global unique identifier of the download.
  • (Optional) browser_context_id: BrowserContext to perform the action in. When omitted, default browser context is used.
@spec close() :: {String.t(), map()}

Close browser gracefully.

@spec crash() :: {String.t(), map()}

Crashes browser on the main thread.

Link to this function

crash_gpu_process()

@spec crash_gpu_process() :: {String.t(), map()}

Crashes GPU process.

Link to this function

execute_browser_command(command_id)

@spec execute_browser_command(browser_command_id()) :: {String.t(), map()}

Invoke custom browser commands used by telemetry.

Parameters:

  • (Required) command_id: description not provided :(
Link to this function

get_browser_command_line()

@spec get_browser_command_line() :: {String.t(), map()}

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

Link to this function

get_histogram(name, delta \\ nil)

@spec get_histogram(String.t(), boolean()) :: {String.t(), map()}

Get a Chrome histogram by name.

Parameters:

  • (Required) name: Requested histogram name.
  • (Optional) delta: If true, retrieve delta since last delta call.
Link to this function

get_histograms(query \\ nil, delta \\ nil)

@spec get_histograms(String.t(), boolean()) :: {String.t(), map()}

Get Chrome histograms.

Parameters:

  • (Optional) 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.
  • (Optional) delta: If true, retrieve delta since last delta call.
@spec get_version() :: {String.t(), map()}

Returns version information.

Link to this function

get_window_bounds(window_id)

@spec get_window_bounds(window_id()) :: {String.t(), map()}

Get position and size of the browser window.

Parameters:

  • (Required) window_id: Browser window id.
Link to this function

get_window_for_target(target_id \\ nil)

@spec get_window_for_target(CDPotion.Domain.Target.target_id()) :: {String.t(), map()}

Get the browser window that contains the devtools target.

Parameters:

  • (Optional) target_id: Devtools agent host id. If called as a part of the session, associated targetId is used.
Link to this function

grant_permissions(permissions, origin \\ nil, browser_context_id \\ nil)

@spec grant_permissions(
  [permission_type()],
  String.t(),
  browser_context_id()
) :: {String.t(), map()}

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

Parameters:

  • (Required) permissions: description not provided :(
  • (Optional) origin: Origin the permission applies to, all origins if not specified.
  • (Optional) browser_context_id: BrowserContext to override permissions. When omitted, default browser context is used.
Link to this function

reset_permissions(browser_context_id \\ nil)

@spec reset_permissions(browser_context_id()) :: {String.t(), map()}

Reset all permission management for all origins.

Parameters:

  • (Optional) browser_context_id: BrowserContext to reset permissions. When omitted, default browser context is used.
Link to this function

set_dock_tile(badge_label \\ nil, image \\ nil)

@spec set_dock_tile(String.t(), String.t()) :: {String.t(), map()}

Set dock tile details, platform-specific.

Parameters:

  • (Optional) badge_label: description not provided :(
  • (Optional) image: Png encoded image. (Encoded as a base64 string when passed over JSON)
Link to this function

set_download_behavior(behavior, browser_context_id \\ nil, download_path \\ nil, events_enabled \\ nil)

@spec set_download_behavior(
  String.t(),
  browser_context_id(),
  String.t(),
  boolean()
) :: {String.t(), map()}

Set the behavior when downloading a file.

Parameters:

  • (Required) 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 dowmload guids.
  • (Optional) browser_context_id: BrowserContext to set download behavior. When omitted, default browser context is used.
  • (Optional) download_path: The default path to save downloaded files to. This is required if behavior is set to 'allow' or 'allowAndName'.
  • (Optional) events_enabled: Whether to emit download events (defaults to false).
Link to this function

set_permission(permission, setting, origin \\ nil, browser_context_id \\ nil)

@spec set_permission(
  permission_descriptor(),
  permission_setting(),
  String.t(),
  browser_context_id()
) :: {String.t(), map()}

Set permission settings for given origin.

Parameters:

  • (Required) permission: Descriptor of permission to override.
  • (Required) setting: Setting of the permission.
  • (Optional) origin: Origin the permission applies to, all origins if not specified.
  • (Optional) browser_context_id: Context to override. When omitted, default browser context is used.
Link to this function

set_window_bounds(window_id, bounds)

@spec set_window_bounds(window_id(), bounds()) :: {String.t(), map()}

Set position and/or size of the browser window.

Parameters:

  • (Required) window_id: Browser window id.
  • (Required) bounds: New window bounds. The 'minimized', 'maximized' and 'fullscreen' states cannot be combined with 'left', 'top', 'width' or 'height'. Leaves unspecified fields unchanged.