Skip to content
A chrome devtools controller that is easy and safe to use.
Go JavaScript HTML Other
Branch: master
Clone or download

Latest commit

Files

Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.github/workflows fix godev version in CI Mar 24, 2020
fixtures select should stop at the first match Mar 30, 2020
lib zenika/alpine-chrome is out of date, use a customized one Apr 5, 2020
.dockerignore zenika/alpine-chrome is out of date, use a customized one Apr 5, 2020
.gitignore zenika/alpine-chrome is out of date, use a customized one Apr 5, 2020
Dockerfile zenika/alpine-chrome is out of date, use a customized one Apr 5, 2020
LICENSE update doc Feb 1, 2020
README.md Add cli google translator example link. Apr 5, 2020
browser.go update doc Mar 23, 2020
browser_test.go add Browser.Incognito Mar 16, 2020
context.go add GetContext Mar 15, 2020
dev_helpers.go support query tracing, useful for long-wait element query Mar 23, 2020
element.go add Element.Screenshot Mar 9, 2020
element_test.go update test Mar 25, 2020
error.go add Element.Resource Feb 12, 2020
examples_test.go update doc Apr 5, 2020
go.mod update deps Mar 23, 2020
go.sum update deps Mar 23, 2020
keyboard.go add Box struct Mar 9, 2020
mouse.go remove the sleep used for debugging Apr 5, 2020
page.go better WaitRequestIdle options Apr 5, 2020
page_test.go better WaitRequestIdle options Apr 5, 2020
query.go add Has helpers to Element Mar 29, 2020
query_test.go select should stop at the first match Mar 30, 2020
setup_test.go optimize defaults Mar 11, 2020
sugar.go better WaitRequestIdle options Apr 5, 2020
utils.go better WaitRequestIdle options Apr 5, 2020

README.md

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.

You can’t perform that action at this time.