MCPcopy Create free account
hub / github.com/aeroxy/chrome-devtools-cli / attach_to_target

Method attach_to_target

src/cdp.rs:713–724  ·  view source on GitHub ↗

Attach to a target and return the session ID for subsequent commands.

(&mut self, target_id: &str)

Source from the content-addressed store, hash-verified

711
712 /// Attach to a target and return the session ID for subsequent commands.
713 pub async fn attach_to_target(&mut self, target_id: &str) -> Result<String> {
714 let result = self
715 .send(
716 "Target.attachToTarget",
717 json!({"targetId": target_id, "flatten": true}),
718 )
719 .await?;
720 result["sessionId"]
721 .as_str()
722 .map(|s| s.to_string())
723 .ok_or_else(|| anyhow!("No sessionId in attachToTarget response"))
724 }
725
726 /// Detach from a target session.
727 pub async fn detach_from_target(&mut self, session_id: &str) -> Result<()> {

Callers 4

run_directFunction · 0.80
new_pageFunction · 0.80
execute_commandFunction · 0.80
collect_sw_logsFunction · 0.80

Calls 1

sendMethod · 0.45

Tested by

no test coverage detected