Get Source code of QWebEnginePage

  • when I press left click on any web page in webEngineview I have the option to view the source code for the current page.
    that I want to do it programming I want to set this page source code to a QString so I can do what I want with it
    I tried both
    QWebEnginePage.toHtml() and toPlaintText but both not give me as I found in the left click view page source code from the view
    for example, i tried on facebook page toHtml give me codes and the view page source code give me a more detailed code that what I want so any help to get this code to QString
    thanks in advance

  • Hi! Don't know why toHtml() and right-click-view disagree. Maybe you can use the following as a work-around. It gives the exact content of the right-click-view:

    // ...
    // on load finished:
    ui->webEngineView->page()->toPlainText( [this](QString const &s){ ui->plainTextEdit->setPlainText(s); } );    

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.