Skip to content

Install

You need three things: Go, a browser that speaks the Chrome DevTools Protocol, and the chromedp module.

chromedp needs Go 1.25 or later. Get Go from go.dev/dl, then check the version:

Terminal window
go version

chromedp starts Chrome or Chromium on the computer that runs the program. It looks for the browser in these places, in order:

  • On Linux and the other Unix systems: headless-shell, chromium, google-chrome and the other names of Chrome on the PATH.
  • On macOS: Chromium, then Google Chrome, in /Applications.
  • On Windows: Chrome on the PATH and in its usual folders, then Microsoft Edge, which is built on Chromium.

To use another browser, give its path with the option chromedp.ExecPath. See Contexts and the browser.

A server with no Chrome can run the container image chromedp/headless-shell, which holds a small build of Chrome. See Connect to a browser.

Make a module for your program, and add chromedp to it:

Terminal window
mkdir hello && cd hello
go mod init example.com/hello
go get github.com/chromedp/chromedp@latest

The packages of the protocol, such as page and network, are in the module github.com/chromedp/cdproto. go get adds it with chromedp.

Next, write your first program.