Package Usage: go: github.com/mafredri/cdp
Package cdp provides type-safe bindings for the Chrome DevTools
Protocol (CDP) and can be used with any debug target that implements it.
The cdp Client requires an rpcc connection (*rpcc.Conn):
The devtool package can be used for finding the websocket URL (see
devtool documentation for more):
Domain methods are used to perform actions or request data over the
Chrome DevTools Protocol.
Methods can be invoked from the Client:
Event clients are used to handle events sent over the protocol. A client
will buffer all events, preserving order, after creation until it is
closed, context done or connection closed. Under the hood, an event
client is a rpcc.Stream.
Create an event client for the DOMContentEventFired event. Call Close
when the client is no longer used to avoid leaking memory. The client
will remain active for the duration of the context or until it is
closed:
Enable (if available) must be called before events are transmitted over
the Chrome DevTools Protocol:
Calling Enable can result in immediate event transmissions. If these
events are important, an event client should be created before calling
Enable.
Wait for an event by calling Recv:
The Ready channel can be used to check for pending events or
coordinating between multiple event handlers:
Ready must not be called concurrently while relying on the non-blocking
behavior of Recv.
Event clients can be synchronized, relative to each other, when the order of
events is important:
Use the Ready channel to detect which synchronized event client is ready to
Recv.
The session package can be used to control multiple targets (e.g. pages) with a
single websocket connection.
75 versions
Latest release: over 2 years ago
85 dependent packages
View more package details: https://packages.ecosystem.code.gouv.fr/registries/proxy.golang.org/packages/github.com/mafredri/cdp