pub struct TargetClient { /* private fields */ }Expand description
Client for Target domain commands.
Implementations§
Source§impl TargetClient
impl TargetClient
Sourcepub async fn activate_target(
&self,
params: ActivateTargetParams,
session_id: Option<&str>,
) -> Result<Value, CdpError>
pub async fn activate_target( &self, params: ActivateTargetParams, session_id: Option<&str>, ) -> Result<Value, CdpError>
Activates (focuses) the target.
Sourcepub async fn attach_to_target(
&self,
params: AttachToTargetParams,
session_id: Option<&str>,
) -> Result<AttachToTargetReturns, CdpError>
pub async fn attach_to_target( &self, params: AttachToTargetParams, session_id: Option<&str>, ) -> Result<AttachToTargetReturns, CdpError>
Attaches to the target with given id.
Sourcepub async fn attach_to_browser_target(
&self,
session_id: Option<&str>,
) -> Result<AttachToBrowserTargetReturns, CdpError>
pub async fn attach_to_browser_target( &self, session_id: Option<&str>, ) -> Result<AttachToBrowserTargetReturns, CdpError>
Attaches to the browser target, only uses flat sessionId mode.
Sourcepub async fn close_target(
&self,
params: CloseTargetParams,
session_id: Option<&str>,
) -> Result<CloseTargetReturns, CdpError>
pub async fn close_target( &self, params: CloseTargetParams, session_id: Option<&str>, ) -> Result<CloseTargetReturns, CdpError>
Closes the target. If the target is a page that gets closed too.
Sourcepub async fn expose_dev_tools_protocol(
&self,
params: ExposeDevToolsProtocolParams,
session_id: Option<&str>,
) -> Result<Value, CdpError>
pub async fn expose_dev_tools_protocol( &self, params: ExposeDevToolsProtocolParams, session_id: Option<&str>, ) -> Result<Value, CdpError>
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 following 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.
Sourcepub async fn create_browser_context(
&self,
params: CreateBrowserContextParams,
session_id: Option<&str>,
) -> Result<CreateBrowserContextReturns, CdpError>
pub async fn create_browser_context( &self, params: CreateBrowserContextParams, session_id: Option<&str>, ) -> Result<CreateBrowserContextReturns, CdpError>
Creates a new empty BrowserContext. Similar to an incognito profile but you can have more than one.
Sourcepub async fn get_browser_contexts(
&self,
session_id: Option<&str>,
) -> Result<GetBrowserContextsReturns, CdpError>
pub async fn get_browser_contexts( &self, session_id: Option<&str>, ) -> Result<GetBrowserContextsReturns, CdpError>
Returns all browser contexts created with Target.createBrowserContext method.
Sourcepub async fn create_target(
&self,
params: CreateTargetParams,
session_id: Option<&str>,
) -> Result<CreateTargetReturns, CdpError>
pub async fn create_target( &self, params: CreateTargetParams, session_id: Option<&str>, ) -> Result<CreateTargetReturns, CdpError>
Creates a new page.
Sourcepub async fn detach_from_target(
&self,
params: DetachFromTargetParams,
session_id: Option<&str>,
) -> Result<Value, CdpError>
pub async fn detach_from_target( &self, params: DetachFromTargetParams, session_id: Option<&str>, ) -> Result<Value, CdpError>
Detaches session with given id.
Sourcepub async fn dispose_browser_context(
&self,
params: DisposeBrowserContextParams,
session_id: Option<&str>,
) -> Result<Value, CdpError>
pub async fn dispose_browser_context( &self, params: DisposeBrowserContextParams, session_id: Option<&str>, ) -> Result<Value, CdpError>
Deletes a BrowserContext. All the belonging pages will be closed without calling their beforeunload hooks.
Sourcepub async fn get_target_info(
&self,
params: GetTargetInfoParams,
session_id: Option<&str>,
) -> Result<GetTargetInfoReturns, CdpError>
pub async fn get_target_info( &self, params: GetTargetInfoParams, session_id: Option<&str>, ) -> Result<GetTargetInfoReturns, CdpError>
Returns information about a target.
Sourcepub async fn get_targets(
&self,
params: GetTargetsParams,
session_id: Option<&str>,
) -> Result<GetTargetsReturns, CdpError>
pub async fn get_targets( &self, params: GetTargetsParams, session_id: Option<&str>, ) -> Result<GetTargetsReturns, CdpError>
Retrieves a list of available targets.
Sourcepub async fn send_message_to_target(
&self,
params: SendMessageToTargetParams,
session_id: Option<&str>,
) -> Result<Value, CdpError>
pub async fn send_message_to_target( &self, params: SendMessageToTargetParams, session_id: Option<&str>, ) -> Result<Value, CdpError>
Sends protocol message over session with given id. Consider using flat mode instead; see commands attachToTarget, setAutoAttach, and crbug.com/991325.
Sourcepub async fn set_auto_attach(
&self,
params: SetAutoAttachParams,
session_id: Option<&str>,
) -> Result<Value, CdpError>
pub async fn set_auto_attach( &self, params: SetAutoAttachParams, session_id: Option<&str>, ) -> Result<Value, CdpError>
Controls whether to automatically attach to new targets which are considered
to be directly related to this one (for example, iframes or workers).
When turned on, attaches to all existing related targets as well. When turned off,
automatically detaches from all currently attached targets.
This also clears all targets added by autoAttachRelated from the list of targets to watch
for creation of related targets.
You might want to call this recursively for auto-attached targets to attach
to all available targets.
Adds the specified target to the list of targets that will be monitored for any related target
creation (such as child frames, child workers and new versions of service worker) and reported
through attachedToTarget. The specified target is also auto-attached.
This cancels the effect of any previous setAutoAttach and is also cancelled by subsequent
setAutoAttach. Only available at the Browser target.
Sourcepub async fn set_discover_targets(
&self,
params: SetDiscoverTargetsParams,
session_id: Option<&str>,
) -> Result<Value, CdpError>
pub async fn set_discover_targets( &self, params: SetDiscoverTargetsParams, session_id: Option<&str>, ) -> Result<Value, CdpError>
Controls whether to discover available targets and notify via
targetCreated/targetInfoChanged/targetDestroyed events.
Sourcepub async fn set_remote_locations(
&self,
params: SetRemoteLocationsParams,
session_id: Option<&str>,
) -> Result<Value, CdpError>
pub async fn set_remote_locations( &self, params: SetRemoteLocationsParams, session_id: Option<&str>, ) -> Result<Value, CdpError>
Enables target discovery for the specified locations, when setDiscoverTargets was set to
true.
Sourcepub async fn get_dev_tools_target(
&self,
params: GetDevToolsTargetParams,
session_id: Option<&str>,
) -> Result<GetDevToolsTargetReturns, CdpError>
pub async fn get_dev_tools_target( &self, params: GetDevToolsTargetParams, session_id: Option<&str>, ) -> Result<GetDevToolsTargetReturns, CdpError>
Gets the targetId of the DevTools page target opened for the given target (if any).
Sourcepub async fn open_dev_tools(
&self,
params: OpenDevToolsParams,
session_id: Option<&str>,
) -> Result<OpenDevToolsReturns, CdpError>
pub async fn open_dev_tools( &self, params: OpenDevToolsParams, session_id: Option<&str>, ) -> Result<OpenDevToolsReturns, CdpError>
Opens a DevTools window for the target.