Developing chrome extension to track file uploads but few websites have input elements inside the #shadow-root (nested) , so docuement.queryselectors doesn't identify the elements.
Any help on this is much appreciated.
Developing chrome extension to track file uploads but few websites have input elements inside the #shadow-root (nested) , so docuement.queryselectors doesn't identify the elements.
Any help on this is much appreciated.
I think there is not an easy way out but selecting every possible node in which a shadow dom could be and then select the input elements in it. If you know first in which nodes you will definitely have a shadow dom, you could tighten the action range using pseudo selector: not ()
document.querySelectorAll('body *').forEach(n => {
if (n.shadowRoot)
Array.from(n.shadowRoot.querySelectorAll('input[type="file"]')).forEach(p => doSomething())
})