Appearance
Install
Prerequisites
- Go 1.18 or later
- Chrome or Chromium installed on the system (chromedp launches Chrome automatically; it does not bundle a browser)
On Linux servers without a display, run Chrome in headless mode (the default) or set up a virtual display with Xvfb if you need headful mode.
Add chromedp to your Go module
bash
go get -u github.com/chromedp/chromedpThis fetches the latest version and updates your go.mod and go.sum files.
Verify the module was added
bash
grep chromedp go.modExpected output:
github.com/chromedp/chromedp v0.15.1(Version number may differ depending on the latest release at install time.)
Import in your Go source
go
import "github.com/chromedp/chromedp"Notes
- chromedp has no external Go dependencies outside the standard library and its own CDP sub-packages (
github.com/chromedp/cdproto). - On Linux, Chrome may exit immediately after your program ends due to process cleanup. For long-running or repeated sessions, use
chromedp.NewRemoteAllocatorto connect to a persistent Chrome instance. - Docker tip: use the
chromedp/headless-shellDocker image to get a pre-configured headless Chrome environment without installing Chrome on the host.