Tungsten v0.1.0 Tungsten.Connection View Source

Manages the connection to a browser

Connection is responsible for keeping track of the CDP command id that is used to keep track of in-flight commands.

Link to this section Summary

Types

An error as result of a CDP command

Represents a CDP 'frame', the raw message data sent over the transport

The result from a CDP command

Option values used by exec_* functions

Options used by exec_* functions

Option values used by start_* functions

Options used by start_* functions

Type of the struct that keeps the connection's internal state

Functions

Returns a specification to start this module under a supervisor.

Executes a command synchronously.

Starts the Connection and connects to the configured transport.

Link to this section Types

Link to this type

cdp_error() View Source
cdp_error() :: map()

An error as result of a CDP command

Link to this type

cdp_frame() View Source
cdp_frame() :: map()

Represents a CDP 'frame', the raw message data sent over the transport

Link to this type

cdp_result() View Source
cdp_result() :: map()

The result from a CDP command

Link to this type

exec_option() View Source
exec_option() :: {:timeout, timeout()} | {:session_id, String.t()}

Option values used by exec_* functions

Link to this type

exec_options() View Source
exec_options() :: [exec_option()]

Options used by exec_* functions

Link to this type

option() View Source
option() :: GenServer.option() | {:transport, keyword()}

Option values used by start_* functions

Link to this type

options() View Source
options() :: [option()]

Options used by start_* functions

Link to this type

state() View Source
state() :: %Tungsten.Connection{
  callbacks: %{optional(non_neg_integer()) => GenServer.from()},
  id: non_neg_integer(),
  transport: GenServer.server() | nil
}

Type of the struct that keeps the connection's internal state

Link to this section Functions

Returns a specification to start this module under a supervisor.

See Supervisor.

Link to this function

exec(connection, method, parameters, options \\ []) View Source
exec(GenServer.server(), String.t(), map(), exec_options()) ::
  {:ok, cdp_result(), cdp_frame()} | {:error, cdp_error(), cdp_frame()}

Executes a command synchronously.

Options:

  • :timeout - an integer greater than zero which specifies how many milliseconds to wait for a reply, or the atom :infinity to wait indefinitely. The default value is 5000.

Starts the Connection and connects to the configured transport.