INNER CODE UNIT · Rust

attach_page_existing

keon/browser-control · src/cdp.rs:117

    pub async fn attach_page_existing(&mut self, target: Option<String>) -> Result<()> {
        let id = match target {
            Some(t) => t,
            None => self
                .first_tab()
                .await?
                .context("no existing page target to attach")?,
        };
        let r = self
            .send(
                "Target.attachToTarget",
                json!({"targetId":id,"flatten":true}),
                None,
            )
            .await?;
        write_current_tab(&id)?;
        let sid = r["sessionId"].as_str().context("sessionId")?.to_string();
        self.session = Some(sid);

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…