Tungsten v0.1.0 Tungsten.CDP.Target View Source
Supports additional targets discovery and allows to attach to them.
Link to this section Summary
Link to this section Types
cdp_browser_context_id_type()
View Source
cdp_browser_context_id_type() :: String.t()
cdp_browser_context_id_type() :: String.t()
This type has no documentation
cdp_remote_location_type() View Source
This type has no documentation
cdp_session_id_type()
View Source
cdp_session_id_type() :: String.t()
cdp_session_id_type() :: String.t()
Unique identifier of attached debugging session.
cdp_target_id_type()
View Source
cdp_target_id_type() :: String.t()
cdp_target_id_type() :: String.t()
This type has no documentation
cdp_target_info_type()
View Source
cdp_target_info_type() :: %{
:target_id => cdp_target_id_type(),
:type => String.t(),
:title => String.t(),
:url => String.t(),
:attached => boolean(),
optional(:opener_id) => cdp_target_id_type(),
optional(:browser_context_id) => cdp_browser_context_id_type()
}
cdp_target_info_type() :: %{
:target_id => cdp_target_id_type(),
:type => String.t(),
:title => String.t(),
:url => String.t(),
:attached => boolean(),
optional(:opener_id) => cdp_target_id_type(),
optional(:browser_context_id) => cdp_browser_context_id_type()
}
This type has no documentation
Link to this section Functions
activate_target(session, parameters, options \\ [])
View Source
activate_target(
GenServer.server(),
%{target_id: cdp_target_id_type()},
Tungsten.Connection.exec_options()
) :: {:ok, map()} | {:error, term()}
activate_target( GenServer.server(), %{target_id: cdp_target_id_type()}, Tungsten.Connection.exec_options() ) :: {:ok, map()} | {:error, term()}
Activates (focuses) the target.
attach_to_browser_target(session, parameters \\ %{}, options \\ [])
View Source
attach_to_browser_target(
GenServer.server(),
map(),
Tungsten.Connection.exec_options()
) :: {:ok, %{session_id: cdp_session_id_type()}} | {:error, term()}
attach_to_browser_target( GenServer.server(), map(), Tungsten.Connection.exec_options() ) :: {:ok, %{session_id: cdp_session_id_type()}} | {:error, term()}
Attaches to the browser target, only uses flat sessionId mode.
attach_to_target(session, parameters, options \\ [])
View Source
attach_to_target(
GenServer.server(),
%{:target_id => cdp_target_id_type(), optional(:flatten) => boolean()},
Tungsten.Connection.exec_options()
) :: {:ok, %{session_id: cdp_session_id_type()}} | {:error, term()}
attach_to_target( GenServer.server(), %{:target_id => cdp_target_id_type(), optional(:flatten) => boolean()}, Tungsten.Connection.exec_options() ) :: {:ok, %{session_id: cdp_session_id_type()}} | {:error, term()}
Attaches to the target with given id.
close_target(session, parameters, options \\ [])
View Source
close_target(
GenServer.server(),
%{target_id: cdp_target_id_type()},
Tungsten.Connection.exec_options()
) :: {:ok, %{success: boolean()}} | {:error, term()}
close_target( GenServer.server(), %{target_id: cdp_target_id_type()}, Tungsten.Connection.exec_options() ) :: {:ok, %{success: boolean()}} | {:error, term()}
Closes the target. If the target is a page that gets closed too.
create_browser_context(session, parameters \\ %{}, options \\ [])
View Source
create_browser_context(
GenServer.server(),
map(),
Tungsten.Connection.exec_options()
) ::
{:ok, %{browser_context_id: cdp_browser_context_id_type()}} | {:error, term()}
create_browser_context( GenServer.server(), map(), Tungsten.Connection.exec_options() ) :: {:ok, %{browser_context_id: cdp_browser_context_id_type()}} | {:error, term()}
Creates a new empty BrowserContext. Similar to an incognito profile but you can have more than one.
create_target(session, parameters, options \\ [])
View Source
create_target(
GenServer.server(),
%{
:url => String.t(),
optional(:width) => integer(),
optional(:height) => integer(),
optional(:browser_context_id) => cdp_browser_context_id_type(),
optional(:enable_begin_frame_control) => boolean()
},
Tungsten.Connection.exec_options()
) :: {:ok, %{target_id: cdp_target_id_type()}} | {:error, term()}
create_target( GenServer.server(), %{ :url => String.t(), optional(:width) => integer(), optional(:height) => integer(), optional(:browser_context_id) => cdp_browser_context_id_type(), optional(:enable_begin_frame_control) => boolean() }, Tungsten.Connection.exec_options() ) :: {:ok, %{target_id: cdp_target_id_type()}} | {:error, term()}
Creates a new page.
detach_from_target(session, parameters \\ %{}, options \\ [])
View Source
detach_from_target(
GenServer.server(),
%{
optional(:session_id) => cdp_session_id_type(),
optional(:target_id) => cdp_target_id_type()
},
Tungsten.Connection.exec_options()
) :: {:ok, map()} | {:error, term()}
detach_from_target( GenServer.server(), %{ optional(:session_id) => cdp_session_id_type(), optional(:target_id) => cdp_target_id_type() }, Tungsten.Connection.exec_options() ) :: {:ok, map()} | {:error, term()}
Detaches session with given id.
dispose_browser_context(session, parameters, options \\ [])
View Source
dispose_browser_context(
GenServer.server(),
%{browser_context_id: cdp_browser_context_id_type()},
Tungsten.Connection.exec_options()
) :: {:ok, map()} | {:error, term()}
dispose_browser_context( GenServer.server(), %{browser_context_id: cdp_browser_context_id_type()}, Tungsten.Connection.exec_options() ) :: {:ok, map()} | {:error, term()}
Deletes a BrowserContext. All the belonging pages will be closed without calling their beforeunload hooks.
expose_dev_tools_protocol(session, parameters, options \\ [])
View Source
expose_dev_tools_protocol(
GenServer.server(),
%{:target_id => cdp_target_id_type(), optional(:binding_name) => String.t()},
Tungsten.Connection.exec_options()
) :: {:ok, map()} | {:error, term()}
expose_dev_tools_protocol( GenServer.server(), %{:target_id => cdp_target_id_type(), optional(:binding_name) => String.t()}, Tungsten.Connection.exec_options() ) :: {:ok, map()} | {:error, term()}
Inject object to the target's main frame that provides a communication channel with browser target.
Injected object will be available as window[bindingName].
The object has the follwing API:
binding.send(json)- a method to send messages over the remote debugging protocolbinding.onmessage = json => handleMessage(json)- a callback that will be called for the protocol notifications and command responses.
get_browser_contexts(session, parameters \\ %{}, options \\ [])
View Source
get_browser_contexts(
GenServer.server(),
map(),
Tungsten.Connection.exec_options()
) ::
{:ok, %{browser_context_ids: [cdp_browser_context_id_type()]}}
| {:error, term()}
get_browser_contexts( GenServer.server(), map(), Tungsten.Connection.exec_options() ) :: {:ok, %{browser_context_ids: [cdp_browser_context_id_type()]}} | {:error, term()}
Returns all browser contexts created with Target.createBrowserContext method.
get_target_info(session, parameters \\ %{}, options \\ [])
View Source
get_target_info(
GenServer.server(),
%{optional(:target_id) => cdp_target_id_type()},
Tungsten.Connection.exec_options()
) :: {:ok, %{target_info: cdp_target_info_type()}} | {:error, term()}
get_target_info( GenServer.server(), %{optional(:target_id) => cdp_target_id_type()}, Tungsten.Connection.exec_options() ) :: {:ok, %{target_info: cdp_target_info_type()}} | {:error, term()}
Returns information about a target.
get_targets(session, parameters \\ %{}, options \\ [])
View Source
get_targets(GenServer.server(), map(), Tungsten.Connection.exec_options()) ::
{:ok, %{target_infos: [cdp_target_info_type()]}} | {:error, term()}
get_targets(GenServer.server(), map(), Tungsten.Connection.exec_options()) :: {:ok, %{target_infos: [cdp_target_info_type()]}} | {:error, term()}
Retrieves a list of available targets.
send_message_to_target(session, parameters, options \\ [])
View Source
send_message_to_target(
GenServer.server(),
%{
:message => String.t(),
optional(:session_id) => cdp_session_id_type(),
optional(:target_id) => cdp_target_id_type()
},
Tungsten.Connection.exec_options()
) :: {:ok, map()} | {:error, term()}
send_message_to_target( GenServer.server(), %{ :message => String.t(), optional(:session_id) => cdp_session_id_type(), optional(:target_id) => cdp_target_id_type() }, Tungsten.Connection.exec_options() ) :: {:ok, map()} | {:error, term()}
Sends protocol message over session with given id.
set_auto_attach(session, parameters, options \\ [])
View Source
set_auto_attach(
GenServer.server(),
%{
:auto_attach => boolean(),
:wait_for_debugger_on_start => boolean(),
optional(:flatten) => boolean()
},
Tungsten.Connection.exec_options()
) :: {:ok, map()} | {:error, term()}
set_auto_attach( GenServer.server(), %{ :auto_attach => boolean(), :wait_for_debugger_on_start => boolean(), optional(:flatten) => boolean() }, Tungsten.Connection.exec_options() ) :: {:ok, map()} | {:error, term()}
Controls whether to automatically attach to new targets which are considered to be related to this one. When turned on, attaches to all existing related targets as well. When turned off, automatically detaches from all currently attached targets.
set_discover_targets(session, parameters, options \\ [])
View Source
set_discover_targets(
GenServer.server(),
%{discover: boolean()},
Tungsten.Connection.exec_options()
) :: {:ok, map()} | {:error, term()}
set_discover_targets( GenServer.server(), %{discover: boolean()}, Tungsten.Connection.exec_options() ) :: {:ok, map()} | {:error, term()}
Controls whether to discover available targets and notify via
targetCreated/targetInfoChanged/targetDestroyed events.
set_remote_locations(session, parameters, options \\ [])
View Source
set_remote_locations(
GenServer.server(),
%{locations: [cdp_remote_location_type()]},
Tungsten.Connection.exec_options()
) :: {:ok, map()} | {:error, term()}
set_remote_locations( GenServer.server(), %{locations: [cdp_remote_location_type()]}, Tungsten.Connection.exec_options() ) :: {:ok, map()} | {:error, term()}
Enables target discovery for the specified locations, when setDiscoverTargets was set to
true.