In this post we will look at leveraging Chrome’s debug protocol to load up a webpage and take a screenshot. This is all made possible from a package called
chromedp which allows us to control a Chrome instance through our Go code. You will also need Chrome installed or to be using something akin to the
chrome/headless-shell docker image.
We’ve split the process in code up into:
- Start Chrome
- Run tasks: like loading the webpage and taking a screenshot
- Saving the screenshot to file