█

AI/TLDR

Buy me a coffee
Buy me a coffee

chromedp

Drive Chrome from Go over the DevTools Protocol, with no external driver

Web Scraping & CrawlingOpen source
Latest
v0.24.0
Updated
18 Nov 2026
Language
Go
License
MIT
$go get -u github.com/chromedp/chromedp

What's new

v0.24.018 Nov 2026

Adds the WithRuntimeDisabled context option, which attaches without Runtime.enable and runs queries in an isolated world so a page cannot detect console-argument serialisation; also fixes a Poll hang inside frames.

IN SHORT

What is chromedp?

chromedp is a Go package that drives browsers speaking the Chrome DevTools Protocol, such as Chrome and Chromium, with no external driver: no Node.js, Selenium or WebDriver process sits between your program and the browser. It sits in the Web Scraping & Crawling category of the Data & Labeling tools and is open-source, written in Go and licensed MIT.

Updated Markdown version ↗

Overview

chromedp is a Go package that drives browsers speaking the Chrome DevTools Protocol, such as Chrome and Chromium, with no external driver: no Node.js, Selenium or WebDriver process sits between your program and the browser. It covers the usual browser-automation jobs — navigating pages, reading text, filling and submitting forms, running JavaScript, intercepting requests, taking screenshots and printing PDFs — from ordinary Go code. The module depends only on the Go standard library and chromedp's generated protocol package, cdproto.

The programming model is built around actions. An action is a function that runs against a browser tab; chromedp.Do runs actions that return nothing and chromedp.Run runs one action and returns its value, so reading a page title is a single call. Page events are Go iterators: chromedp.Events subscribes when it returns, so a program can subscribe, trigger the event and then range over it without missing it. Each context made with chromedp.NewContext holds a browser and a tab, and child contexts open new tabs in the same browser that are safe to use from separate goroutines.

By default chromedp starts Chrome headless and talks to it through a pipe (Chrome's --remote-debugging-pipe), so no debugging port is opened. The bundled remote package adds a websocket client for attaching to a browser that is already running, such as a container or a hosted service, and for keeping a browser open after the program exits. A visible window is one option (WithVisibleWindow, or CHROMEDP_VISIBLEWINDOW=1), and the companion termcast module streams the screen of a headless page into a terminal that can show images, even over ssh.

The project dates from 2017, when it was presented at GopherCon Singapore as a new way to drive the web from Go. Version v0.20.0 introduced the generic, iterator-based API built on typed cdproto, and the README links a migration guide listing every renamed and removed name. The companion chromedp/examples repository holds 46 single-file programs for larger tasks, and the chromedp/headless-shell Docker image provides a smaller headless build of Chrome that chromedp finds by default. It is MIT-licensed.

VideoThe GopherCon Singapore 2017 talk introducing chromedp, linked from the project README; the API has since moved to the v0.20+ action style shown below.Singapore Gophers ↗

What it does

  • Pure Go client for the Chrome DevTools Protocol — no Node, Selenium or WebDriver, only the standard library plus cdproto
  • Action-based API: chromedp.Do for side effects, chromedp.Run to return a value, chromedp.Call for any raw protocol command
  • Page events as Go iterators that subscribe before you trigger them, so no event is missed
  • Headless by default over a pipe; optional websocket, remote attach and keep-open via the remote package
  • Tabs as contexts: child contexts open parallel tabs in one browser, safe across goroutines
  • Screenshots, PDF printing, device emulation, request interception, cookies, downloads and HAR capture, each shown in the examples repository
  • WithRuntimeDisabled attaches without enabling the Runtime domain, running queries in an isolated world of each frame

Getting started

chromedp is a normal Go module; it needs Go 1.25 or newer and a Chrome or Chromium install (or the chromedp/headless-shell image). The steps below follow the project README.

Add the module

bashbash
go get -u github.com/chromedp/chromedp

Open a page and read its title

NewContext creates a browser context; the first action starts Chrome. Do runs actions that return nothing, Run returns a value.

gogo
ctx, cancel := chromedp.NewContext(context.Background())
defer cancel()

if err := chromedp.Do(ctx, chromedp.Navigate(`https://pkg.go.dev/`)); err != nil {
	log.Fatal(err)
}
title, err := chromedp.Run(ctx, chromedp.Title())
if err != nil {
	log.Fatal(err)
}
fmt.Println(title)

Wait for a page event

Events subscribes as soon as it returns, so you can subscribe, navigate, then read the event from the iterator.

gogo
loaded := chromedp.Events(ctx, page.LoadEventFired)
if err := chromedp.Do(ctx, chromedp.Navigate(`https://pkg.go.dev/`)); err != nil {
	log.Fatal(err)
}
for ev, err := range loaded {
	if err != nil {
		log.Fatal(err)
	}
	fmt.Println(ev.Timestamp)
	break
}

Attach to a browser that is already running

For a container or hosted browser, point the remote allocator at its websocket address and build contexts from it.

gogo
allocCtx, cancel := remote.NewAllocator(context.Background(), "ws://127.0.0.1:9222/")
defer cancel()
ctx, cancel := chromedp.NewContext(allocCtx)
defer cancel()
title, err := chromedp.Run(ctx, chromedp.Title())

Run a bigger example

Each program in chromedp/examples is one main.go; add -visible to show the browser window or -v to print the protocol messages.

bashbash
go run github.com/chromedp/examples/tabs@latest

Commands and code are distilled from the project's own documentation — always check the official repo for the latest.

When to use it

  • Scraping pages that only render in a real browser, from a Go service with no Node or Selenium dependency
  • Generating screenshots and PDFs of web pages in a Go backend or a headless-shell container
  • End-to-end tests and form automation written in Go, with request interception and cookie control
  • Giving a Go-based agent or crawler a scriptable browser, locally or attached to a remote Chrome

How chromedp compares

chromedp alongside other open-source web scraping & crawling tools AI/TLDR tracks, ranked by GitHub stars.

ToolStarsWhat it does
Firecrawl★ 214kA crawling service and API that converts whole websites into clean Markdown or structured JSON ready for LLMs.
Agent Reach★ 116kA capability layer that installs, health-checks and routes readers so a CLI agent can read and search web pages, YouTube, RSS, GitHub, Reddit, Twitter/X and more without API fees.
Scrapling★ 107kA Python web scraping framework whose parser relocates your elements when pages change, with stealthy fetchers and a Scrapy-like spider engine for full crawls.
Crawl4AI★ 88.2kA local-first Python web crawler that turns pages into clean Markdown for use in RAG and LLM pipelines.
Scrapy★ 65.7kA mature Python framework for writing fast spiders that crawl websites and extract structured data at scale.
changedetection.io★ 36.1kA self-hosted web page change monitor with XPath/CSS/jq filters, browser steps and restock alerts, which can route every diff through an LLM to suppress noise.
ScrapeGraphAI★ 33kA Python library that uses LLMs and a graph pipeline to extract data from pages based on natural-language prompts.
chromedp★ 13.4kDrive Chrome from Go over the DevTools Protocol, with no external driver