chrome-remote-interface 0.1.0-alpha.7

Chrome DevTools Protocol Client.
Documentation

chrome-remote-interface

Chrome DevTools Protocol client.

Currently Work In Progress.

Example

use chrome_remote_interface::Browser;
use chrome_remote_interface::model::target::{CreateTargetCommand, AttachToTargetCommand};

#[tokio::main(flavor = "current_thread")]
async fn main() -> anyhow::Result<()> {
    let browser = Browser::launcher()
        .headless(true) // headless mode (Default)
        .launch()
        .await?;

    let (mut client, task) = browser.connect().await?;
    tokio::spawn(task); // Spawn message loop.

    // Open new page
    let response = client.request(CreateTargetCommand::builder()
            .url("https://example.org/".into())
            .build()
            .unwrap()
        )
        .await?;

    // Attach opened page.
    let response = client
        .request(AttachToTargetCommand::new((*response).clone(), Some(true)))
        .await?;

    // construct attached session.
    let mut session = client.session(response);
    // DO STUFF

    Ok(())
}

License

Licensed under either of

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.!

License: MIT OR Apache-2.0