# chromedp

> Drive Chrome from Go over the Chrome DevTools Protocol. Tutorials with runnable programs and recordings of each step.

The page: https://chromedp.dev/

chromedp is a Go package. It starts Chrome, or connects to a Chrome that runs
already, and drives it: it loads pages, clicks, types, reads the page, takes
screenshots, prints PDFs, and watches or changes the network. Programs use it
to test web sites, to scrape them, and to make images and documents.

Play the recording below. It shows a program while it drives Chrome: the line
of Go that runs, the page at that moment, and the messages of the protocol
that the line sends.

Recording: A first program loads a page, reads it and clicks a button. It shows `tutorials/first-program/run.go` while it drives Chrome/158.0.8127.88. Its frames and protocol messages are in /recordings/first-program/timeline.json. The steps:

1. Line 15: `if err := chromedp.Do(ctx, chromedp.Navigate(url)); err != nil {`
2. Line 20: `title, err := chromedp.Run(ctx, chromedp.Title())`
3. Line 28: `heading, err := chromedp.Run(ctx, chromedp.Text(chromedp.CSS("h1")))`
4. Line 35: `if err := chromedp.Do(ctx, chromedp.Click(chromedp.CSS("#greet"))); err != nil {`
5. Line 41: `greeting, err := chromedp.Run(ctx, chromedp.Text(chromedp.CSS("#greeting"), chromedp.NodeVisible))`

## Learn chromedp

1. [Install](/start/install/) Go, Chrome and chromedp.
2. Write [your first program](/start/first-program/).
3. Read the [concepts](/concepts/contexts/): contexts, actions and selectors.
4. Follow a tutorial: [fill in a form](/tutorials/forms/), [take screenshots and PDFs](/tutorials/screenshots/), [read the console](/tutorials/console/) or [intercept requests](/tutorials/intercept/).

Every tutorial is a complete program in the
[repository of this site](https://github.com/chromedp/chromedp-site/tree/main/tutorials).
A test runs each one in Chrome and checks its output.

## For coding agents

[/llms.txt](/llms.txt) lists every page as Markdown, and
[/llms-full.txt](/llms-full.txt) holds the whole site in one file. Add `.md`
to the address of a page to get its Markdown, such as
[/start/install.md](/start/install.md). See [For coding agents](/project/agents/).
