INNER CODE UNIT · Rust

attach_page

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

    pub async fn attach_page(&mut self, target: Option<String>) -> Result<()> {
        self.attach_page_light(target).await?;
        let sid = self.session.as_ref().context("session")?.clone();
        self.send("Runtime.enable", json!({}), Some(sid.clone()))
            .await?;
        self.send("Page.enable", json!({}), Some(sid.clone()))
            .await?;
        self.send("Network.enable", json!({}), Some(sid.clone()))
            .await?;
        let _ = self.send("Log.enable", json!({}), Some(sid)).await;
        Ok(())
    }

    pub async fn attach_page_existing(&mut self, target: Option<String>) -> Result<()> {
        let id = match target {
            Some(t) => t,
            None => self
                .first_tab()

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…