Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt WebKit
  4. How to click on WebView Link Programatically and load resultant page in same WebView
Forum Updated to NodeBB v4.3 + New Features

How to click on WebView Link Programatically and load resultant page in same WebView

Scheduled Pinned Locked Moved Qt WebKit
4 Posts 3 Posters 2.3k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Z Offline
    Z Offline
    Zain
    wrote on last edited by
    #1

    Hello All,

    In my QT application I am using QWebView for loading any webpage and getting their source code on LoadFinished slot.
    First web page is containing link of Next Page,so now I want to click on that Next Page link via code
    and that next page should be load in same webview so that I can get source code of that page again.

    Please give any suggestion or solution.Attaching code would be more helpful for me.

    Thanks in Advance

    Zain

    1 Reply Last reply
    0
    • A Offline
      A Offline
      AcerExtensa
      wrote on last edited by
      #2

      Clicking the link is simply sending the request to the server, you even do not need WebKit for that. "QNetworkAccessManager":http://qt-project.org/doc/qt-5.0/qtnetwork/qnetworkaccessmanager.html will be enough.

      God is Real unless explicitly declared as Integer.

      1 Reply Last reply
      0
      • A Offline
        A Offline
        AcerExtensa
        wrote on last edited by
        #3

        But if you need webview, then simply find needed link in finished slot and call webview->load with found link as an argument.

        God is Real unless explicitly declared as Integer.

        1 Reply Last reply
        0
        • Y Offline
          Y Offline
          yearl
          wrote on last edited by
          #4

          Or you can use JavaScipt to do it:

          @mainFrame()->evaluateJavaScript(“\nvar evt = document.createEvent('Event');\nevt.initEvent('click',true,true);\ndocument.getElementsByTagName(\‘a\’)[0].dispatchEvent(evt);”);@

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved