I am facing an issue with a page that contains multiple document fragments. I need to retrieve all elements from the entire page that match a specific selector, like so.
document.querySelectorAll('iframe')
However, this does not return elements from inner document fragments. After some research, I discovered I can use the following method:
hostElement.shadowRoot.querySelectorAll('iframe')
The challenge is that I require all matched elements across document fragments in the "top" document, but I do not know which elements on the page are hosts. Is there a way to achieve this without specifying host elements? I am utilizing Selenium WebDriver, so any solution related to it would also be appreciated.