Tiana987642
Tiana987642

Reputation: 754

Interact with web browser using Qt/bash script?

I frequently need to access to the router to do some simple task: restart, switch on/off some options... And the repeated process really annoying me :(

I want to write a batch script/program which do it for me.

I can't flash the router with the DD-WRT firmware to access it via console. The policy don't allow it.

Then I come up with an idea that use Qt write a small program which will interact with the browser. Access the router IP, fill the password, browse to the option page...

However, AFAIK, I can only do such thing with a web-driver like selenium, which is unavailable with Qt.

So is there any solution? I really like the idea use Qt or a script to solve the problem.

Any ideas are appreciated :)

Upvotes: 1

Views: 291

Answers (1)

j123b567
j123b567

Reputation: 3439

It is possible to just send form response and don't load the page in the QWebFrame. You can use some tool (firebug, wireshark) to catch the request/response when you click "save" and learn what to send to your router everytime you want this configuration. It will be simple HTTP GET or POST request. That request can be done with curl, wget or your simple QT application using QNetworkRequest or wethewer.

It will be more tricky if it needs authentification other then HTTP basic auth. You will need two requests

  • first one - authenticate and save all cookies
  • second one - set parameters and add all cookies to response

Upvotes: 1

Related Questions