INNER CODE UNIT · Rust

attach_frame

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

    pub async fn attach_frame(&mut self, target: &str) -> Result<()> {
        let id = self.resolve_target(target, &["iframe", "page"]).await?;
        let r = self
            .send(
                "Target.attachToTarget",
                json!({"targetId":id,"flatten":true}),
                None,
            )
            .await?;
        let sid = r["sessionId"].as_str().context("sessionId")?.to_string();
        self.session = Some(sid.clone());
        self.target = Some(id);
        self.send("Runtime.enable", json!({}), Some(sid.clone()))
            .await?;
        let _ = self.send("Page.enable", json!({}), Some(sid.clone())).await;
        let _ = self
            .send("Network.enable", json!({}), Some(sid.clone()))
            .await;

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…