Expand description

A high-level API for programmatically interacting with the Chrome DevTools Protocol.

This crate uses the [Chrome DevTools protocol] to drive/launch a Chromium or Chrome (potentially headless) browser.


use futures::StreamExt;
use chromiumoxide::{Browser, BrowserConfig};

async fn main() -> Result<(), Box<dyn std::error::Error>> {

    let (browser, mut handler) =

    let handle = async_std::task::spawn(async move {
        loop {
            let _event = handler.next().await.unwrap();

    let page = browser.new_page("https://en.wikipedia.org").await?;

    // type into the search field and hit `Enter`,
    // this triggers a navigation to the search result page
            .type_str("Rust programming language")

    let html = page.wait_for_navigation().await?.content().await?;


The [chromiumoxide_pdl] crate contains a PDL parser, which is a rust rewrite of a python script in the chromium source tree and a Generator that turns the parsed PDL files into rust code. The chromiumoxide_cdp crate only purpose is to integrate the generator during is build process and include the generated output before compiling the crate itself. This separation is done merely because the generated output is ~60K lines of rust code (not including all the Proc macro extensions). So expect the compilation to take some time.

The generator can be configured and used independently, see [build.rs] of chromiumoxide_cdp.

chromedp rust-headless-chrome which the launch config, KeyDefinition and typing support is taken from. puppeteer


pub use chromiumoxide_types as types;
pub use crate::browser::Browser;
pub use crate::browser::BrowserConfig;
pub use crate::conn::Connection;
pub use crate::element::Element;
pub use crate::error::Result;
pub use crate::handler::Handler;
pub use crate::page::Page;



Represents a binary type as defined in the CDP protocol.


Trait that all the request types have to implement.

Methods are message types that contain the field method = Self::identifier() in their json body.

A trait that identifies a method on type level