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

Chromedp — Drive Browsers with the Chrome DevTools Protocol in Go

Pure Go library for controlling browsers via the Chrome DevTools Protocol, without external dependencies like Selenium or PhantomJS.

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
Chromedp
Comando de instalación directa
npx -y tokrepo@latest install 0eaccd35-754d-11f1-9bc6-00163e2b0d79 --target codex

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

Introduction

Chromedp is a pure Go package for driving browsers using the Chrome DevTools Protocol (CDP). It provides a high-level API for navigating pages, filling forms, clicking elements, taking screenshots, and extracting data, all without requiring Selenium, WebDriver, or any external binary dependencies beyond a Chrome or Chromium installation.

What Chromedp Does

  • Controls Chrome and Chromium browsers programmatically via CDP
  • Navigates pages, clicks elements, fills forms, and submits data
  • Takes full-page and element-level screenshots in PNG format
  • Evaluates JavaScript in the browser context and retrieves results
  • Captures network events, console logs, and DOM snapshots

Architecture Overview

Chromedp communicates with the browser over a WebSocket connection using the Chrome DevTools Protocol. It manages browser process lifecycle (launching, connecting, and closing), creates browser contexts and tabs, and translates high-level actions into sequences of CDP commands. Everything runs in-process as a Go library with no CGo or external binary dependencies.

Self-Hosting & Configuration

  • Add to your Go project with go get github.com/chromedp/chromedp
  • Requires Chrome or Chromium installed on the host (or use a headless Docker image)
  • Configure browser launch flags via chromedp.Flag options (headless, proxy, window size)
  • Use chromedp.NewRemoteAllocator to connect to an existing browser or remote debugging port
  • Set timeouts and contexts using standard Go context.Context patterns

Key Features

  • Zero external dependencies beyond Chrome/Chromium itself
  • Composable action API chains multiple browser operations in a single Run call
  • Full CDP access for advanced use cases (network interception, performance tracing)
  • Headless and headed modes for testing and debugging
  • Supports concurrent browser contexts for parallel scraping or testing

Comparison with Similar Tools

  • Selenium — Requires WebDriver binaries and language bindings; chromedp is a single Go import
  • Puppeteer — Node.js CDP library; chromedp brings the same concept to Go
  • Playwright — Multi-browser automation in JS/Python; chromedp is Go-native and Chrome-focused
  • Rod — Another Go CDP library with auto-download; chromedp has a larger community
  • Colly — Go web scraping framework using HTTP; chromedp renders JavaScript pages

FAQ

Q: Does chromedp work in headless mode? A: Yes. By default, chromedp launches Chrome in headless mode. You can switch to headed mode for debugging.

Q: Can I use chromedp for end-to-end testing? A: Yes. Many teams use chromedp for browser-based integration tests in Go projects.

Q: Does chromedp support file downloads? A: Yes. You can configure the download directory and intercept download events via CDP.

Q: Is chromedp compatible with Docker? A: Yes. Use a headless Chrome Docker image and connect chromedp via the remote debugging port.

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