Package chromedp is a faster, simpler way to drive browsers in Go using the Chrome Debugging Protocol (for Chrome, Edge, Safari, etc) without external dependencies (ie, Selenium, PhantomJS, etc).
NOTE: chromedp's API is currently unstable, and may change at a moments notice. There are likely extremely bad bugs lurking in this code. CAVEAT USER.
Install in the usual way:
go get -u github.com/chromedp/chromedp
Below is a simple Google search performed using chromedp (taken from examples/simple):
This example shows logic for a simple search for a known website, clicking on the right link, and then taking a screenshot of a specific element on the loaded page and saving that to a local file on disk.
Please see the examples project for more examples. Please refer to the GoDoc API listing for a summary of the API and Actions.
- chromedp: A New Way to Drive the Web - GopherCon SG 2017 talk
- Chrome DevTools Protocol - Chrome Debugging Protocol Domain documentation
- chromedp examples - various
chromedp
examples github.com/chromedp/cdproto
- GoDoc listing for the CDP domains used bychromedp
github.com/chromedp/cdproto-gen
- tool used to generatecdproto
github.com/chromedp/chromedp-proxy
- a simple CDP proxy for logging/debugging CDP clients and browser instances
- Move timeouts to context (defaults)
- Implement more query selector options (allow over riding context timeouts)
- Contextual actions for "dry run" (or via an accumulator?)
- Network loader / manager
- Profiler