How can i access shadow dom elements on a web page from a chrome extension and also a firefox extension?

Viewed 19

For example if the code on the webpage that the chrome extension is running on has the following code, where is part of a shadow dom. How would i target shadowtag from the extension to examine its text content?

<parentTag>
  #shadow-root (closed)
  <shadowTag id="textid">Text</shadowTag>
</parentTag>

I understand there are a couple of functions available, chrome.dom.openOrClosedShadowRoot in the chrome extension api and element.openOrClosedShadowRoot in firefox but I cannot find any examples of their usage, so a bit stuck as to how to use those functions to access shadow elements. Any help with this would be fantastic! :)

0 Answers
Related