Tungsten v0.1.0 Tungsten.CDP.Browser View Source

Browser

The Browser domain defines methods and events for browser managing.

Link to this section Summary

Link to this section Types

Link to this type

cdp_bounds_type() View Source
cdp_bounds_type() :: %{
  optional(:left) => integer(),
  optional(:top) => integer(),
  optional(:width) => integer(),
  optional(:height) => integer(),
  optional(:window_state) => cdp_window_state_type()
}

Browser.Bounds

Browser window bounds information

Link to this type

cdp_bucket_type() View Source
cdp_bucket_type() :: %{low: integer(), high: integer(), count: integer()}

Browser.Bucket

Chrome histogram bucket.

Link to this type

cdp_histogram_type() View Source
cdp_histogram_type() :: %{
  name: String.t(),
  sum: integer(),
  count: integer(),
  buckets: [cdp_bucket_type()]
}

Browser.Histogram

Chrome histogram.

Link to this type

cdp_permission_type_type() View Source
cdp_permission_type_type() ::
  :idle_detection
  | :video_capture
  | :sensors
  | :protected_media_identifier
  | :payment_handler
  | :notifications
  | :midi_sysex
  | :midi
  | :geolocation
  | :flash
  | :durable_storage
  | :clipboard_write
  | :clipboard_read
  | :background_fetch
  | :background_sync
  | :audio_capture
  | :accessibility_events

Browser.PermissionType

This type has no documentation

Link to this type

cdp_window_id_type() View Source
cdp_window_id_type() :: integer()

Browser.WindowID

This type has no documentation

Link to this type

cdp_window_state_type() View Source
cdp_window_state_type() :: :fullscreen | :maximized | :minimized | :normal

Browser.WindowState

The state of the browser window.

Link to this section Functions

Link to this function

close(session, parameters \\ %{}, options \\ []) View Source
close(GenServer.server(), map(), Tungsten.Connection.exec_options()) ::
  {:ok, map()} | {:error, term()}

Browser.close

Close browser gracefully.

Link to this function

crash(session, parameters \\ %{}, options \\ []) View Source
crash(GenServer.server(), map(), Tungsten.Connection.exec_options()) ::
  {:ok, map()} | {:error, term()}

Browser.crash

Crashes browser on the main thread.

Link to this function

crash_gpu_process(session, parameters \\ %{}, options \\ []) View Source
crash_gpu_process(
  GenServer.server(),
  map(),
  Tungsten.Connection.exec_options()
) :: {:ok, map()} | {:error, term()}

Browser.crashGpuProcess

Crashes GPU process.

Link to this function

get_browser_command_line(session, parameters \\ %{}, options \\ []) View Source
get_browser_command_line(
  GenServer.server(),
  map(),
  Tungsten.Connection.exec_options()
) :: {:ok, %{arguments: [String.t()]}} | {:error, term()}

Browser.getBrowserCommandLine

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(session, parameters, options \\ []) View Source
get_histogram(
  GenServer.server(),
  %{:name => String.t(), optional(:delta) => boolean()},
  Tungsten.Connection.exec_options()
) :: {:ok, %{histogram: cdp_histogram_type()}} | {:error, term()}

Browser.getHistogram

Get a Chrome histogram by name.

Link to this function

get_histograms(session, parameters \\ %{}, options \\ []) View Source
get_histograms(
  GenServer.server(),
  %{optional(:query) => String.t(), optional(:delta) => boolean()},
  Tungsten.Connection.exec_options()
) :: {:ok, %{histograms: [cdp_histogram_type()]}} | {:error, term()}

Browser.getHistograms

Get Chrome histograms.

Link to this function

get_version(session, parameters \\ %{}, options \\ []) View Source
get_version(GenServer.server(), map(), Tungsten.Connection.exec_options()) ::
  {:ok,
   %{
     protocol_version: String.t(),
     product: String.t(),
     revision: String.t(),
     user_agent: String.t(),
     js_version: String.t()
   }}
  | {:error, term()}

Browser.getVersion

Returns version information.

Link to this function

get_window_bounds(session, parameters, options \\ []) View Source
get_window_bounds(
  GenServer.server(),
  %{window_id: cdp_window_id_type()},
  Tungsten.Connection.exec_options()
) :: {:ok, %{bounds: cdp_bounds_type()}} | {:error, term()}

Browser.getWindowBounds

Get position and size of the browser window.

Link to this function

get_window_for_target(session, parameters \\ %{}, options \\ []) View Source
get_window_for_target(
  GenServer.server(),
  %{optional(:target_id) => Tungsten.CDP.Target.cdp_target_id_type()},
  Tungsten.Connection.exec_options()
) ::
  {:ok, %{window_id: cdp_window_id_type(), bounds: cdp_bounds_type()}}
  | {:error, term()}

Browser.getWindowForTarget

Get the browser window that contains the devtools target.

Link to this function

grant_permissions(session, parameters, options \\ []) View Source
grant_permissions(
  GenServer.server(),
  %{
    :origin => String.t(),
    :permissions => [cdp_permission_type_type()],
    optional(:browser_context_id) =>
      Tungsten.CDP.Target.cdp_browser_context_id_type()
  },
  Tungsten.Connection.exec_options()
) :: {:ok, map()} | {:error, term()}

Browser.grantPermissions

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

Link to this function

reset_permissions(session, parameters \\ %{}, options \\ []) View Source
reset_permissions(
  GenServer.server(),
  %{
    optional(:browser_context_id) =>
      Tungsten.CDP.Target.cdp_browser_context_id_type()
  },
  Tungsten.Connection.exec_options()
) :: {:ok, map()} | {:error, term()}

Browser.resetPermissions

Reset all permission management for all origins.

Link to this function

set_dock_tile(session, parameters \\ %{}, options \\ []) View Source
set_dock_tile(
  GenServer.server(),
  %{optional(:badge_label) => String.t(), optional(:image) => String.t()},
  Tungsten.Connection.exec_options()
) :: {:ok, map()} | {:error, term()}

Browser.setDockTile

Set dock tile details, platform-specific.

Link to this function

set_window_bounds(session, parameters, options \\ []) View Source
set_window_bounds(
  GenServer.server(),
  %{window_id: cdp_window_id_type(), bounds: cdp_bounds_type()},
  Tungsten.Connection.exec_options()
) :: {:ok, map()} | {:error, term()}

Browser.setWindowBounds

Set position and/or size of the browser window.