Important: Please read the Qt Code of Conduct -

QWebElement evaluateJavaScript doesn't work

  • Hello all, I have a code
    @QWebView view;;
    QWebElement elem =>mainFrame()->documentElement();
    QEventLoop loopLoad;


    elem.evaluateJavaScript("document.getElementById("search-text").value = "Some text";");@

    But I don't see "Some text" in search label. Simple scripts like alert() works, but not that

  • Moderators

    not sure if it helps but try this:
    @>mainFrame()->evaluateJavaScript("document.getElementById("search-text").value = "Some text";");

    Also you can listen to the QWebPage's signal consoleMessageReceived() to check for javascript errors.

  • Oh yeah, thanks! now works

Log in to reply