Qt Code:
  1. #include <QApplication>
  2. #include <QDebug>
  3. #include <QWebPage>
  4. #include <QWebFrame>
  5. #include <QWebElement>
  6.  
  7. int main(int argc, char *argv[])
  8. {
  9. QApplication a(argc, argv);
  10. QWebPage frame;
  11. frame.mainFrame()->setHtml("<html><body><p>First Paragraph</p><p>Second Paragraph</p></body></html>");
  12. QWebElement doc = frame.mainFrame()->documentElement();
  13. QWebElement body = doc.firstChild();
  14. qDebug() << body.toPlainText();
  15. QWebElement firstParagraph = body.firstChild();
  16. qDebug() << firstParagraph.toPlainText();
  17. QWebElement secondParagraph = firstParagraph.nextSibling();
  18. qDebug() << secondParagraph.toPlainText();
  19. return a.exec();
  20. }
To copy to clipboard, switch view to plain text mode 
Output is :

This example is from oficial doc so why this always empty and when i use other exaples it is empty too.