MCPcopy
hub / github.com/chromedp/chromedp

github.com/chromedp/chromedp @v0.15.1 sqlite

repository ↗ · DeepWiki ↗ · release v0.15.1 ↗
528 symbols 2,512 edges 46 files 249 documented · 47%
README

About chromedp

Package chromedp is a faster, simpler way to drive browsers supporting the Chrome DevTools Protocol in Go without external dependencies.

Unit Tests Go Reference Releases

Installing

Install in the usual Go way:

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

Examples

Refer to the Go reference for the documentation and examples. Additionally, the examples repository contains more examples on complex actions, and other common high-level tasks such as taking full page screenshots.

Frequently Asked Questions

I can't see any Chrome browser window

By default, Chrome is run in headless mode. See DefaultExecAllocatorOptions, and an example to override the default options.

I'm seeing "context canceled" errors

When the connection to the browser is lost, chromedp cancels the context, and it may result in this error. This occurs, for example, if the browser is closed manually, or if the browser process has been killed or otherwise terminated.

Chrome exits as soon as my Go program finishes

On Linux, chromedp is configured to avoid leaking resources by force-killing any started Chrome child processes. If you need to launch a long-running Chrome instance, manually start Chrome and connect using RemoteAllocator.

Executing an action without Run results in "invalid context"

By default, a chromedp context does not have an executor, however one can be specified manually if necessary; see issue #326 for an example.

I can't use an Action with Run because it returns many values

Wrap it with an ActionFunc:

ctx, cancel := chromedp.NewContext(context.Background())
defer cancel()
chromedp.Run(ctx, chromedp.ActionFunc(func(ctx context.Context) error {
    _, err := domain.SomeAction().Do(ctx)
    return err
}))

I want to use chromedp on a headless environment

The simplest way is to run the Go program that uses chromedp inside the chromedp/headless-shell image. That image contains headless-shell, a smaller headless build of Chrome, which chromedp is able to find out of the box.

Resources

Extension points exported contracts — how you extend this code

Allocator (Interface)
An Allocator is responsible for creating and managing a number of browsers. This interface abstracts away how the brows [2 …
allocate.go
Action (Interface)
Action is the common interface for an action that will be executed against a context and frame handler. [2 implementers]
chromedp.go
Device (Interface)
Device is the shared interface for known device types. See [device] for a set of off-the-shelf devices and modes. [1 implementers]
emulate.go
Transport (Interface)
Transport is the common interface to send/receive messages to a target. This interface is currently used internally by [1 …
conn.go
ActionFunc (FuncType)
ActionFunc is an adapter to allow the use of ordinary func's as an Action.
chromedp.go

Core symbols most depended-on inside this repo

Run
called by 215
chromedp.go
Do
called by 82
chromedp.go
NewContext
called by 72
chromedp.go
Navigate
called by 53
nav.go
Flag
called by 40
allocate.go
Close
called by 35
conn.go
FromContext
called by 31
chromedp.go
QueryAfter
called by 26
query.go

Shape

Function 454
Method 40
Struct 16
TypeAlias 11
Interface 4
FuncType 3

Languages

Go83%
TypeScript17%

Modules by API surface

testdata/twgl-full.min.js75 symbols
query.go65 symbols
query_test.go40 symbols
chromedp_test.go32 symbols
chromedp.go32 symbols
allocate.go31 symbols
util.go30 symbols
example_test.go18 symbols
kb/gen.go17 symbols
input.go16 symbols
nav_test.go15 symbols
allocate_test.go14 symbols

Dependencies from manifests, versioned

github.com/chromedp/cdprotov0.0.0-2026032100182 · 1×
github.com/chromedp/sysutilv1.1.0 · 1×
github.com/go-json-experiment/jsonv0.0.0-2026021400441 · 1×
github.com/gobwas/httpheadv0.1.0 · 1×
github.com/gobwas/poolv0.2.1 · 1×
github.com/ledongthuc/pdfv0.0.0-2022030213484 · 1×
github.com/orisano/pixelmatchv0.0.0-2022072200265 · 1×
golang.org/x/sysv0.42.0 · 1×

For agents

$ claude mcp add chromedp \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact