jsdom-screenshot icon indicating copy to clipboard operation
jsdom-screenshot copied to clipboard

jsdom-screenshot not generating a screenshot for web components

Open eladtzemach opened this issue 2 years ago • 2 comments

Hi, i have a React component that uses web components (imported from a third-party library). I noticed that jsdom-screenshot does not render the UI rendered by those web components, and only renders the UI of other HTML elements. Is there a way to get the screenshots to render the web components as well?

eladtzemach avatar Jun 12 '22 22:06 eladtzemach

Interesting! I haven't used web components myself, so I'm not very helpful here.

A wild guess is that this line might not catch the HTML when a web component is used, as JSDOM might not be "rendering" the web component?

https://github.com/dferber90/jsdom-screenshot/blob/4bcc86e858bdfe7fc03e0e352d07d57ed0b41942/generateImage.js#L115

dferber90 avatar Jun 21 '22 18:06 dferber90

Yeah it looks like this could be the case. To get the HTML of a web component, we might need to use the ShadowRoot.innerHTML API.

eladtzemach avatar Jun 21 '22 19:06 eladtzemach