-
Suggestion
-
Resolution: Unresolved
-
P2: Important
-
None
-
None
-
None
As you all know, QWebElement is unavailable with QtWebEngine. The usual replacement to access DOM elements is using scripts:
Qt WebEngine does not allow direct access to the document object model (DOM) of a page. However, the DOM can be inspected and adapted by injecting scripts.
However, more and more websites started using Shadow DOMs. As a prominent example, Gerrit (e.g. codereview.qt-project.org) places the entire page into a Shadow DOM, so that e.g. running document.getElementsByTagName('a') via runJavaScript (or even using the devtools) will return an empty collection.
For those cases (as well as cross-origin iframes, though there are probably workarounds there), it's thus impossible for the application to access page elements. My project (qutebrowser) uses that extensively to let users select links via keyboard:
But with Gerrit (and many other websites or parts of websites using shadow DOMs), it's impossible to do so.
Would it be possible for QWebEngineScript and runJavaScript to somehow allow running scripts in a more privileged way, so that those scripts could access that information?
I didn't find any information on how Chromium accesses that information, only for Firefox: