GithubHelp home page GithubHelp logo

rust-headless-chrome's Introduction

Headless Chrome

Build Status Crate API

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

use headless_chrome::{Browser, LaunchOptionsBuilder};

fn browse_wikipedia() -> Result<(), failure::Error> {
    let options = LaunchOptionsBuilder::default().build().expect("Failed to find chrome");
    let browser = Browser::new(options)?;

    let tab = browser.wait_for_initial_tab()?;

    tab.navigate_to("https://www.wikipedia.org")?;

    tab.wait_for_element("input#searchInput")?
       .click()?;
    tab.type_str("WebKit")?
       .press_key("Enter")?;

    tab.wait_for_element("#firstHeading")?;
    assert_eq!(true, tab.get_url().ends_with("WebKit"));
    Ok(())
}

assert!(browse_wikipedia().is_ok());

For fuller examples, take a look at tests/simple.rs and examples/real_world.rs.

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.

Missing features

Contributing

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

rust-headless-chrome's People

Contributors

atroche avatar leshow avatar lukaslueg avatar messense avatar r-darwish avatar ravi0213 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.