Esta página se muestra en inglés. Una traducción al español está en curso.
ScriptsJul 3, 2026·3 min de lectura

Rod — Chrome DevTools Protocol Driver for Go

A high-level Go library for controlling browsers via the Chrome DevTools Protocol, designed for web automation, scraping, and testing.

Listo para agents

Instalación lista para agent

Este activo puede instalarse después de elegir el runtime, revisar el plan y ejecutar el comando correspondiente.

Native · 98/100Política: permitir
Superficie agent
Cualquier agent MCP/CLI
Tipo
Skill
Instalación
Single
Confianza
Confianza: Established
Entrada
Rod
Comando de instalación directa
npx -y tokrepo@latest install cd2b9df3-76b8-11f1-9bc6-00163e2b0d79 --target codex

Ejecutar después de confirmar el plan con dry-run.

Introduction

Rod is a Go library that provides a high-level API for browser automation through the Chrome DevTools Protocol (CDP). It enables developers to control Chromium-based browsers programmatically for tasks like web scraping, end-to-end testing, screenshot generation, and PDF rendering, all from native Go code.

What Rod Does

  • Controls Chromium browsers programmatically for navigation, clicking, typing, and form submission
  • Captures screenshots and generates PDFs of web pages with full rendering fidelity
  • Intercepts and modifies network requests for testing and scraping scenarios
  • Evaluates JavaScript in the browser context and extracts DOM data
  • Manages browser lifecycle including headless mode, multiple tabs, and incognito contexts

Architecture Overview

Rod communicates directly with Chrome via the DevTools Protocol over WebSocket. Unlike Selenium, it does not require a separate WebDriver binary. The library auto-downloads a compatible Chromium binary on first run. Rod's API is designed around a fluent chain pattern with both must-style (panic on error) and error-returning variants for flexibility in application vs. test code.

Self-Hosting & Configuration

  • Add Rod as a Go module dependency with go get github.com/go-rod/rod
  • Rod auto-manages browser binaries; set ROD_BROWSER env var to use a specific Chrome path
  • Configure headless mode, viewport size, and user-agent via the launcher options
  • Use rod.New().Trace(true) during development to log all CDP commands
  • Deploy in Docker using a Chromium-based image for server-side automation

Key Features

  • Zero external dependencies; communicates directly via CDP without WebDriver
  • Auto-downloads and manages Chromium binaries for reproducible environments
  • Fluent API with both panic-style (Must) and idiomatic Go error handling
  • Built-in stealth mode helpers to reduce bot detection fingerprints
  • Supports concurrent page control for parallel scraping and testing

Comparison with Similar Tools

  • Playwright — multi-language with broader browser support; Rod is Go-native and lighter
  • Puppeteer — Node.js CDP library; Rod provides the same CDP approach for Go
  • Selenium/WebDriver — requires a separate driver binary; Rod connects directly via CDP
  • chromedp — another Go CDP library; Rod offers a higher-level, more ergonomic API
  • Colly — Go web scraper without browser rendering; Rod handles JavaScript-heavy pages

FAQ

Q: Does Rod require Chrome to be installed? A: No. Rod automatically downloads a compatible Chromium binary on first use. You can also point it to an existing installation.

Q: Can I run Rod in a Docker container? A: Yes. Use a Docker image with Chromium installed and set the browser path via environment variables.

Q: How does Rod compare to chromedp? A: Rod provides a higher-level API with auto-wait, element selectors, and fluent chains. chromedp is lower-level and closer to raw CDP.

Q: Is Rod suitable for production scraping? A: Yes. Rod supports concurrent pages, request interception, and stealth options for production-grade automation.

Sources

Discusión

Inicia sesión para unirte a la discusión.
Aún no hay comentarios. Sé el primero en compartir tus ideas.

Activos relacionados