Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Perform an automatic click on a webpage
Forum Updated to NodeBB v4.3 + New Features

Perform an automatic click on a webpage

Scheduled Pinned Locked Moved General and Desktop
3 Posts 3 Posters 2.5k 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.
  • M Offline
    M Offline
    manuel2459
    wrote on 25 Dec 2011, 21:07 last edited by
    #1

    Hello everybody,

    I am a beginner in Qt and I would like to build a program able to click automatically on some link on webpages, depending on signals with Qt.

    For example, if I want to click automatically on a part of google.com, i wrote this:

    @#include <QApplication>
    #include <QWebView>
    #include <QCursor>

    int main(int argc, char *argv[])
    {
    QApplication app(argc, argv);

    QWebView *pageWeb = new QWebView;
    pageWeb->load(QUrl("http://www.google.com/"));

    QCursor::setPos(220,130);

    void QTest::mousePress ( QWidget * widget, Qt::MouseButton button, Qt::KeyboardModifiers modifier = 0, QPoint pos = QPoint(220,30), int delay = -1 )

    return app.exec();
    }
    @

    Could you help me on this please?

    Many thanks for your help!

    1 Reply Last reply
    0
    • G Offline
      G Offline
      goetz
      wrote on 25 Dec 2011, 23:25 last edited by
      #2

      I would say, this is more a topic for dealing with the DOM structure of a web page but not with sending signals in Qt. Also, be aware that the position you calculate heavily depends on font sizes, window sizes, etc. You might consider JavaScript for dealing with that.

      http://www.catb.org/~esr/faqs/smart-questions.html

      1 Reply Last reply
      0
      • 0 Offline
        0 Offline
        010110102
        wrote on 27 Dec 2011, 02:16 last edited by
        #3

        Well if you require not a very high speed... you could look into "IMacros" for firefox e.g.
        No programming needed, it does what you tell him to do ;)
        If you want to do it more seriously, well you should look into Script languages, like Volker pointed out.
        Qt and C++ are not really helping in that matter ;)

        1 Reply Last reply
        0

        1/3

        25 Dec 2011, 21:07

        • Login

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