Skip to content
No description, website, or topics provided.
Branch: master
Clone or download
Type Name Latest commit message Commit time
Failed to load latest commit information.
examples Remove examples/real_world and dependencies Mar 21, 2019
src Remove stray println Mar 21, 2019
tests Add Tab.get_script_source and enable / disable debugger methods (#114) Mar 21, 2019
.gitignore Update gitignore Feb 17, 2019
.travis.yml Add Tab.get_script_source and enable / disable debugger methods (#114) Mar 21, 2019
Cargo.toml Remove examples/real_world and dependencies Mar 21, 2019 Add fetcher as a default feature (#113) Mar 20, 2019

Headless Chrome

Build Status Crate API Discord channel

Puppeteer for Rust. It looks a little something like this:

use headless_chrome::{browser::default_executable, Browser,
                      LaunchOptionsBuilder, protocol::page::ScreenshotFormat};

fn browse_wikipedia() -> Result<(), failure::Error> {
    let options = LaunchOptionsBuilder::default()
    let browser = Browser::new(options)?;

    let tab = browser.wait_for_initial_tab()?;

    /// Navigate to wikipedia

    /// Wait for network/javascript/dom to make the search-box available
    /// and click it.

    /// Type in a query and press `Enter`

    /// We should end up on the WebKit-page once navigated

    /// Take a screenshot of the entire browser window
    let _jpeg_data = tab.capture_screenshot(

    /// Take a screenshot of just the WebKit-Infobox
    let _png_data = tab
        .wait_for_element("#mw-content-text > div > table.infobox.vevent")?


For fuller examples, take a look at tests/ and examples/

If you're looking to do general browser testing or scraping (rather than anything specific to Chrome / DevTools), you're probably better off with fantoccini for now. It's a lot more feature-complete and stable.


If you get errors related to timeouts, you likely need to enable sandboxing either in the kernel or as a setuid sandbox. Puppeteer has some information about how to do that here

By default, headless_chrome will download a compatible version of chrome to XDG_DATA_HOME (or equivalent on Windows/Mac). This behaviour can be optionally turned off, and you can use the system version of chrome (assuming you have chrome installed) by disabling the default feature in your Cargo.toml:

default-features = false

Missing features


Pull requests and issues are most welcome, even if they're just experience reports. If you find anything frustrating or confusing, let me know!

You can’t perform that action at this time.