If we look at a plain source code of a website we will see that all ads, or most of them (flash, Google, others) are inserted as a JavaScript code. But if you look at the code in for example Firefox Firebug you will see that the JavaScript have been replaced with the HTML code of the add.
I want to load and parse this “full” html and I believed that Qt WebKit can do such stuff.

I tried to do it in that way:
Qt Code:
  1. PageLoader::PageLoader(const QUrl &url)
  2. {
  3. mWebPage = new QWebPage();
  4. mWebPage->settings()->setAttribute(QWebSettings::JavascriptEnabled, true);
  5. mWebPage->settings()->setAttribute(QWebSettings::PluginsEnabled, false);
  6. mWebPage->settings()->setAttribute(QWebSettings::AutoLoadImages, false);
  7. mWebPage->settings()->setAttribute(QWebSettings::JavascriptCanOpenWindows, false);
  8. connect(mWebPage->mainFrame(),SIGNAL(loadFinished(bool)), this, SLOT(processPage()));
  9. mWebPage->currentFrame()->load(url);
  10. }
  11.  
  12. void PageLoader::processPage()
  13. {
  14. QWebFrame* frame = mWebPage->currentFrame();
  15. QString webHtml = frame->toHtml();
  16. QFile file("/home/ostap/output.txt");
  17. file.open(QIODevice::WriteOnly | QIODevice::Text);
  18. QTextStream out(&file);
  19. out << webHtml;
  20. emit finished();
  21. }
To copy to clipboard, switch view to plain text mode 

But in output file I have only plain html with links to *.js files in script tags.

Where is my problem?