Crates.io | chrome-remote-interface |
lib.rs | chrome-remote-interface |
version | 0.1.0-alpha.8 |
source | src |
created_at | 2021-02-12 12:35:17.652079 |
updated_at | 2021-07-02 04:18:49.967184 |
description | Chrome DevTools Protocol Client. |
homepage | |
repository | https://github.com/yskszk63/chrome-remote-interface-rs |
max_upload_size | |
id | 354175 |
size | 105,566 |
Chrome DevTools Protocol client.
Currently Work In Progress.
CRI_CHROME_BIN
if specified.C:\Program Files\Chromium\Application\chrome.exe
/Applications/Chromium.app/Contents/MacOS/Chromium
/usr/bin/chromium
or /usr/bin/chromium-browser
PATH
env var.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?;
browser.run_with(|mut client| async move {
// 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(())
}).await
}
Licensed under either of
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