Search code examples
google-chrome-devtoolsscreenshot

How to take screenshot of a DOM node with overflow:auto in Chrome Dev Tools?


I'm trying to take a screenshot of a main part of an application in Chrome Dev Tools, which is wrapped in a UI with top navigation and a sidebar. Slack, Gmail and many others work like that.

When I open Dev Tools, find the div that holds the main content area and invoke Capture node screenshot, I only get the visible part of it: for example, what I currently see in Slack, not the entire loaded history of a channel.

It's probably connected to overflow:auto as I can't even take a screenshot of a very small paragraph here:

https://developer.mozilla.org/en-US/docs/Web/CSS/overflow#Examples

Is that a limitation of Dev Tools? Is there a trick of how to take the screenshot of such nodes? I'm especially interested in Slack or Gmail scenarios where the nodes typically have thousands of pixels vertically.


Solution

  • Chrome implemented it in v89: https://developers.google.com/web/updates/2021/01/devtools#node-screenshot