Backplane.CDP.Client (backplane_cdp v1.10.112)

Copy Markdown

Bounded, single-command Chrome DevTools Protocol connections to local Chrome.

Discovery always uses the configured loopback port. Each operation owns its connection in a separate process and never replays a command after a failure.

Summary

Functions

Returns a validated loopback WebSocket endpoint for a page target.

Sends a CDP command on the connection owned by the current callback.

Consumes matching events as a command runs, acknowledging each event after consume returns :ok. The callback may stop the command with {:error, message}. Other events are discarded for this command, and the response is never replayed.

Waits for a protocol event on the current bounded connection.

Runs related commands on one bounded connection, preserving session-scoped object IDs.

Functions

command(port, target, method, params)

@spec command(pos_integer(), :browser | String.t(), String.t(), map()) ::
  {:ok, map()} | {:error, String.t()}

page_socket_url(port, target)

Returns a validated loopback WebSocket endpoint for a page target.

pages(port)

@spec pages(pos_integer()) :: {:ok, [map()]} | {:error, String.t()}

send_command(map, method, params)

Sends a CDP command on the connection owned by the current callback.

stream_command(map, method, params, event_method, consume)

Consumes matching events as a command runs, acknowledging each event after consume returns :ok. The callback may stop the command with {:error, message}. Other events are discarded for this command, and the response is never replayed.

wait_for_event(map, method, timeout)

Waits for a protocol event on the current bounded connection.

with_connection(port, target, operation, timeout \\ 15000)

Runs related commands on one bounded connection, preserving session-scoped object IDs.