Re:Puppeteer: Headless Chrome Node API
by borplk on Wednesday August 16, 2017 @02:59PM
(#15030144)
Does anyone know if it's possible to take a screenshot of a specific DOM element? (instead of the entire page)
[ Parent
| on HN ]
Re:Puppeteer: Headless Chrome Node API
by paulirish on Wednesday August 16, 2017 @03:58PM
(#15030745)
Yes using the `clip` option of screenshot(), you can get these dimensions from an element's getBoundingClientRect().
full example of screenshoting a DOM element:
https://github.com/GoogleChrome/puppeteer/issues/306#issueco...
Thank you. That's perfect.
Currently only PDF printing of the entire page view-port is available. File an issue with your use-case so the team can assess whether or not to look into including that kind of behavior.
It is already supported, as Paul Irish said
Looks like the ChromeDevToolsProtocol (which this library uses) can, see the docs here:
https://chromedevtools.github.io/devtools-protocol/tot/Page/...