Hello, when accessing the html of an element on a webpage, QWebEngine gives different results to the "Inspect Element" dev tool in Chrome or Firefox. The Qt functions http://doc.qt.io/qt-5/qwebenginepage...unJavaScript-2 and http://doc.qt.io/qt-5/qwebenginepage.html#toHtml both seem to return the html before Javascript has run on the page, whereas Chrome & Firefox return it after.

Example:

Down the side of a youtube page eg https://www.youtube.com/watch?v=1nydxbGhgv8 is a list of similar videos with thumbnails. The brains at google store the image url for these thumbnails in a HTML5 attribute data-thumb, and swap this url into the <img src= using Javascript in the user's browser.

When you inspect these thumbnails in Chrome & Firefox, you see a nice clean <img> tag, pointing to the correct source. You get the same thing when accessing the html of these thumbnails with JavaScript: var elems = $( "span.yt-uix-simple-thumb-wrap.yt-uix-simple-thumb-related:first" ); elems.html();.

jquery issue.jpg

In Qt with a QWebEngineView, when you do page()->toHtml(), you get the <img> tag before the source has been swapped using JavaScript. Similarly, when you load the jQuery library and then run:

Qt Code:
  1. QString code = "var elems = qt.jQuery( 'span.yt-uix-simple-thumb-wrap.yt-uix-simple-thumb-related:first' ); elems.html();";
  2. webView->page()->runJavaScript(code, [&](const QVariant &v){ showResults(v.toString()); });
To copy to clipboard, switch view to plain text mode 

... the variable v also contains the <img> tag before the source has been set.

The question

How does one view the final source code of such webpages, after all the JavaScript has been run, in the same way as the Chrome/Firefox dev tools?