chromedp drives Chrome and compatible browsers from Go via the DevTools Protocol without an external WebDriver. It starts browsers over a pipe by default and supports headless or visible automation.
Overview
chromedp is a Go package that controls browsers implementing the Chrome DevTools Protocol. It needs no separate driver: the module launches Chrome and communicates through a pipe, using only the standard library plus cdproto types. A related remote subpackage adds WebSocket connectivity when attaching to an already running browser or hosted debugging endpoint.
Automation centers on actions run against a browser tab context created with chromedp.NewContext. chromedp.Run and chromedp.Do execute navigation, DOM queries, form input, network introspection, screenshots, and direct protocol commands via chromedp.Call. Page events expose iterator-style subscriptions so tests can trigger and await specific browser signals.
By default Chrome runs headless; visible windows opt in through allocator options or environment variables, with Linux requiring a display or Wayland session. Programs can keep browsers open after exit, connect to remote containers, or run inside the chromedp/headless-shell image on headless servers. Parallel work uses separate tab contexts per goroutine rather than sharing one context.
Cross-site iframes require attaching to separate targets or deliberately disabling site isolation for trusted pages. Companion examples and termcast utilities stream screencasts to capable terminals. Documentation covers migration from older APIs and protocol edge cases such as Enter key handling in rich text editors.
Key features
- DevTools Protocol from Go
- No external WebDriver required
- Default pipe-based browser launch
- Headless and visible window modes
- Remote WebSocket browser attach
- Multi-tab parallel contexts
- Direct cdproto command calls
- headless-shell container support
Use cases
- Go integration and UI tests
- Headless page scraping and forms
- DevTools event-driven automation
- Remote browser debugging workflows
- Terminal screencast demos