Results 1 to 2 of 2

Thread: QWebElement evaluateJavaScript this.click() method

  1. #1
    Join Date
    Sep 2014
    Posts
    1
    Qt products
    Qt4 Qt5 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows Android

    Default QWebElement evaluateJavaScript this.click() method

    Hello folks.

    I have the HTML form in QWebView loaded. This HTML has following two elements:
    Qt Code:
    1. <button class="submit1" tabindex="1" type="submit" id="submit1">accept</butto
    2. <button class="submit2" tabindex="2" type="submit" id="submit2">decline</button>
    To copy to clipboard, switch view to plain text mode 

    In code I have follwing:

    Qt Code:
    1. QWebView webView;
    2. ...
    3. QWebElement button = webView->page()->mainFrame()->documentElement().findFirst("button[id=\"submit1\"]");
    4. button.evaluateJavaScript("this.click();");
    To copy to clipboard, switch view to plain text mode 

    And this last line of code don't work for me.
    Moreover if I have an <input> element instead of button - JavaScript click() method works fine

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QWebElement evaluateJavaScript this.click() method

    Does button refer to a valid element before line #4?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. how to draw on a QWebElement
    By 26_zhang@163.com in forum Qt Programming
    Replies: 1
    Last Post: 24th June 2014, 02:25
  2. Replies: 2
    Last Post: 24th February 2014, 08:47
  3. QWebElement evaluateJavaScript problem
    By Talei in forum Newbie
    Replies: 0
    Last Post: 10th March 2011, 04:38
  4. QWebElement::evaluateJavaScript strange behaviour
    By piotr.dobrogost in forum Qt Programming
    Replies: 3
    Last Post: 11th January 2011, 11:45
  5. Problem with evaluateJavaScript()
    By piotr.dobrogost in forum Qt Programming
    Replies: 0
    Last Post: 26th August 2009, 19:36

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.