Skip to content

rod

7,161 3 217 MIT
v0.116.2 (12 Jul 2024) Sep 23 2022

Rod is a high-level Go library for browser automation built on the Chrome DevTools Protocol (CDP). It provides a simpler and more intuitive API compared to chromedp, making it easier to write browser automation and web scraping scripts in Go.

Key features include:

  • Simple API Rod's API is designed to be intuitive and requires less boilerplate than chromedp. Common operations like clicking, typing, and waiting are straightforward single-line calls.
  • Auto-wait Automatically waits for elements to be ready before interacting with them, reducing the need for explicit wait statements and making scripts more reliable.
  • Page pool Built-in page pool for managing multiple browser pages efficiently, useful for concurrent scraping tasks.
  • Stealth mode Includes a stealth plugin (rod/lib/launcher/flags) that can disable common automation detection vectors.
  • Element screenshots Can take screenshots of specific elements, not just full pages.
  • Network interception Supports hijacking network requests and responses for modification or monitoring.
  • Input emulation Realistic mouse and keyboard input emulation for interacting with complex web applications.

Rod is the recommended choice for new Go browser automation projects due to its simpler API and active maintenance. It is comparable to Playwright in terms of developer experience but native to the Go ecosystem.

Highlights


cdpfast

Example Use


package main

import (
    "fmt"
    "github.com/go-rod/rod"
    "github.com/go-rod/rod/lib/launcher"
)

func main() {
    // Launch browser
    url := launcher.New().Headless(true).MustLaunch()
    browser := rod.New().ControlURL(url).MustConnect()
    defer browser.MustClose()

    // Navigate and auto-wait for the page to load
    page := browser.MustPage("https://example.com")
    page.MustWaitStable()

    // Find elements and extract text - auto-waits for element
    title := page.MustElement("h1").MustText()
    fmt.Println("Title:", title)

    // Fill in a form
    page.MustElement("input[name='search']").MustInput("web scraping")
    page.MustElement("button[type='submit']").MustClick()

    // Wait for results and extract
    page.MustWaitStable()
    results := page.MustElements(".result-item")
    for _, el := range results {
        text := el.MustText()
        href := el.MustElement("a").MustProperty("href").String()
        fmt.Printf("Result: %s (%s)\n", text, href)
    }

    // Take screenshot of specific element
    page.MustElement(".results").MustScreenshot("results.png")
}

Alternatives / Similar


13,387 v0.24.0 (2026-11-18 05:04:28 ago) Mar 11 2022 compare

Other Languages

101,263 1.65.1 (2026-11-28 05:27:44 ago) Jan 23 2015 compare
15,138 1.65.2 (2026-11-14 00:28:39 ago) Feb 24 2021 compare
34,616 4.54.0 (2026-11-23 09:08:00 ago) Apr 25 2008 compare
26,174 4.5.0 (2026-11-27 21:43:59 ago) Oct 29 2024 compare
122,292 1.0.9 (2026-11-26 23:16:49 ago) Nov 01 2024 compare
12,918 3.5.5 (2024-02-17 17:18:36 ago) Sep 04 2020 compare
13,900 0.5.9 (2026-11-01 06:22:04 ago) Mar 01 2024 compare
4,969 0.50.99 (2026-10-26 13:47:46 ago) Jan 15 2024 compare
7,155 3.0.1 (2026-11-08 11:38:44 ago) Jun 01 2024 compare
1,837 0.7.1 (2026-11-13 15:27:15 ago) Dec 28 2012 compare
3,072 v2.4.0 (2026-01-08 05:29:21 ago) Jul 17 2018 compare
23,559 1.0.58 (2026-11-15 00:18:00 ago) Feb 01 2024 compare
861 1.9.4 (2024-10-22 01:41:19 ago) Jul 22 2022 compare
4,190 3.5 (2020-06-16 13:27:02 ago) Apr 25 2014 compare
Was this page helpful?