QWebElement evaluateJavaScript doesn't work

  • Hello all, I have a code
    @QWebView view;
    QWebElement elem = view.page()->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:
    view.page()->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

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