Package cdp provides type-safe bindings for the Chrome DevTools Protocol (CDP), written in the Go programming language.
Package cdp provides type-safe bindings for the Chrome DevTools Protocol (CDP), written in the Go programming language.
Package cdp provides type-safe bindings for the Chrome DevTools Protocol (CDP), written in the Go programming language. The bindings are generated (by cdpgen) from the latest tip-of-tree (tot) protocol definitions and are mainly intended for use with Google Chrome or Chromium, however, they can be used with any debug target (Node.js, Edge DevTools Protocol, Safari, etc.) that implement the protocol.
This package can be used for any kind of browser automation, scripting or debugging via the Chrome DevTools Protocol.
A big motivation for cdp is to expose the full functionality of the Chrome DevTools Protocol and provide it in a discoverable and self-documenting manner.
Providing high-level browser automation is a non-goal for this project. That being said, cdp hopes to improve the ergonomics of working with the protocol by providing primitives better suited for Go and automating repetitive tasks.
$ go get -u github.com/mafredri/cdpSee API documentation for package, API descriptions and examples. Examples can also be found in this repository, see the simple, advanced, logging and incognito examples.
The main packages are cdp and rpcc, the former provides the CDP bindings and the latter handles the RPC communication with the debugging target.
To connect to a debug target, a WebSocket debugger URL is needed. For example, if Chrome is running with --remote-debugging-port=9222 the debugger URL can be found at localhost:9222/json. The devtool package can also be used to query the DevTools JSON API (see example below).
Here is an example of using cdp:
…For more information, consult the documentation.
The Go implementation of gRPC (grpc-go) has been a source of inspiration for some of the design decisions made in the cdp and rpcc packages. Some ideas have also been borrowed from the net/rpc package from the standard library.
No open issues yet, or sync has not completed.