commit | 300a39108866adf08297ab7bb0de133de5af25ac | [log] [tgz] |
---|---|---|
author | Daniel Martà <mvdan@mvdan.cc> | Mon May 13 08:09:03 2019 |
committer | Daniel Martà <mvdan@mvdan.cc> | Mon May 13 08:09:03 2019 |
tree | 195f34db5deb0643e0f2b2b1eb7cc0b5e79eda8a | |
parent | 9dcb20c2d55a44ed107953d23a8161c5e569d461 [diff] |
use listeners for all command responses Adding command response messages to the Listen API has one big advantage; we can drop all the respByID code, and instead have both Execute functions set up a listener to wait for the right response. This also greatly simplifies cmdQueue, as it can now simply contain the message to write over the transport. This change does make the Execute functions slightly more expensive, as they need to set up a context and a listener. However, we don't expect that users will run thousands of actions at once on a single target, so that's a non-issue. Finally, this change requires listeners to be run asynchronously, as otherwise the target handler can deadlock itself. That's an OK change to make, as the documentation makes no promises about how Listen callbacks work.
Package chromedp is a faster, simpler way to drive browsers supporting the Chrome DevTools Protocol in Go using the without external dependencies (like Selenium or PhantomJS).
Install in the usual Go way:
go get -u github.com/chromedp/chromedp
Refer to the GoDoc page for the documentation and examples. The examples repository contains more complex scenarios.
chromedp
examplesgithub.com/chromedp/cdproto
- GoDoc listing for the CDP domains used by chromedp
github.com/chromedp/cdproto-gen
- tool used to generate cdproto
github.com/chromedp/chromedp-proxy
- a simple CDP proxy for logging CDP clients and browsers