Skip to content
/ rod Public
forked from go-rod/rod

A Devtools driver to make web automation and scraping easy

License

Notifications You must be signed in to change notification settings

czqn8/rod

Repository files navigation

Overview

GoDoc codecov goreport

Rod is a High-level Chrome Devtools controller directly based on Chrome DevTools Protocol. Rod also tries to expose low-level interfaces to users, so that whenever a function is missing users can easily send control requests to the browser directly.

Features

  • Fluent interface design to reduce verbose code
  • Chained context design, intuitive to timeout or cancel the long-running task
  • Debugging friendly, auto input tracing, and screenshots
  • Automatically find or download chrome
  • No external dependencies, CI tested on Linux, Mac, and Windows
  • High-level helpers like WaitStable, WaitRequestIdle, GetDownloadFile, Resource
  • Two-step WaitEvent design, never miss an event
  • Correctly handles nested iframes
  • No zombie chrome process after the crash (how it works)

Examples

Here are the basic examples. For more details, please read the unit tests.

A cli google translator example.

FAQ

How to use Rod inside a docker container

To let rod work with docker is very easy. Here's the example to demonstrate how to build an image and run the unit tests of Rod:

docker build -t test https://github.com/ysmood/rod.git
docker run --rm --cap-add=SYS_ADMIN -it test

Why another puppeteer like lib

There are a lot of great projects, but no one is perfect, choose the best one that fits your needs is important.

  • puppeteer

    With Puppeteer, you have to handle promise/async/await a lot. It requires a deep understanding of how promises works which are usually painful for QA to write automation tests. End to end tests usually requires a lot of sync operations to simulate human inputs, because Puppeteer is based on Nodejs all control signals it sends to chrome will be async calls, so it's unfriendly for QA from the beginning.

  • chromedp

    With Chromedp, you have to use their verbose DSL like tasks to handle the main logic and it's painful to deal with iframes. Because Chromedp uses several wrappers to handle execution with context and options which makes it very hard to understand their code when bugs happen. When a crash happens, Chromedp will leave the zombie chrome process on Windows and Mac.

  • cypress

    Cypress is very limited, to test cross-domain iframes such as payments, it's almost unusable. Read their limitation doc.

About

A Devtools driver to make web automation and scraping easy

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Go 98.3%
  • HTML 1.6%
  • Other 0.1%