Perform an automatic click on a webpage
-
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!
-
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.
-
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 ;)