Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/yskszk63/chrome-remote-interface-rs
Chrome DevTools Protocol Client.
https://github.com/yskszk63/chrome-remote-interface-rs
async cdp chrome chrome-devtools-protocol chromium tokio
Last synced: 6 days ago
JSON representation
Chrome DevTools Protocol Client.
- Host: GitHub
- URL: https://github.com/yskszk63/chrome-remote-interface-rs
- Owner: yskszk63
- License: apache-2.0
- Created: 2021-02-11T01:51:32.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2021-10-06T11:59:43.000Z (about 3 years ago)
- Last Synced: 2024-10-11T23:17:33.635Z (about 1 month ago)
- Topics: async, cdp, chrome, chrome-devtools-protocol, chromium, tokio
- Language: Rust
- Homepage:
- Size: 312 KB
- Stars: 8
- Watchers: 4
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE-APACHE
Awesome Lists containing this project
README
# chrome-remote-interface
[Chrome DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/) client.
Currently Work In Progress.
### Supported Browser
- Chromium (latest)
### Browser Discovery
1. Using environemnt variable `CRI_CHROME_BIN` if specified.
2. Search Platform path.
- Windows: `C:\Program Files\Chromium\Application\chrome.exe`
- Mac: `/Applications/Chromium.app/Contents/MacOS/Chromium`
- Linux: `/usr/bin/chromium` or `/usr/bin/chromium-browser`
3. Lookup via `PATH` env var.### Example
```rust
use chrome_remote_interface::Browser;
use chrome_remote_interface::model::target::{CreateTargetCommand, AttachToTargetCommand};#[tokio::main(flavor = "current_thread")]
async fn main() -> anyhow::Result<()> {
pretty_env_logger::init();
let browser = Browser::launcher()
.headless(true) // headless mode (Default)
.launch()
.await?;let client = browser.connect();
// 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
* Apache License, Version 2.0
([LICENSE-APACHE](LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0)
* MIT license
([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT)
at your option.### 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