Writing web forms filler / submitter with QT C ++

I scratch my head on how to accomplish the following task: I need to write a simple web form filler / submitter with QT C ++, it does the following:

1) Loads the page URL 2) Fills in the form fields 3) Submits the form

It sounds simple, but I am a web developer and I can’t find a way to complete the QT task, I managed to load the URL with the QWebView object using WebKit, I don’t know what to do next, how to fill in the fields and submit the forms. Any tips, tutorials, videos? I appreciate it.

+4
source share
2 answers

The QWebElement class does all the work, just by reading the class documentation, I gave a complete idea of ​​how to complete my task. Thanks to eveyrone for the suggestions.

+2
source

A better solution would be to write logic in JavaScript that does what you want and then inject it into the page using QWebFrame :: evaluationJavaScript () after the download is complete.

There is another way to do this; using the document tree traversal API available in QtWebKit since 4.6: QWebElement . You basically process the form in much the same way as in JavaScript, except that here the API differs and is more limited. This is C ++, although it can be a little faster. I think this approach may be less attractive to you as you are a web developer and probably already know JavaScript.

+1
source

All Articles