I am trying to write a Chrome extension that can read a url that is hidden in the html document of a specified webpage. Somewhere in the HTML is a 'resizing-iframe' with the tag 'd2l-iframe-wrapper-for-react', which has a 'src' attribute that I want to read (see bottom picture). However, using document.getElementsByTagName doesn't work, and I suspect it is because somewhere in the HTML document, there is an iframe that itself contains an HTML document, and that one contains the element that I need (see top image). My question is: how do I get this element from this inner HTML document?
I need something like this:
var innerDocumentWrappingDiv = document.getElementsByClassName('d2l-fra-iframe')[0];
var innerDocument = innerDocumentWrappingDiv.firstChild; // the iframe containing the document
var elementThatIsNeeded = innerDocument.getElementsByTagName("d2l-iframe-wrapper-for-react")[0];
However this doesn't work because innerDocument is not recognized as an actual document. Any help is much appreciated!