My tata wimax connection works well most of the time but it has a supremely annoying feature that to get connected, one is redirected to login in their login site (pretty much how the internet connection works in many hotels). If you are idle for sometime, it will auto logoff. Since my internet connection is not so fast, I usually download over the night and open a keepalive window.
This worked well up until a couple of months back. Now they seem to have decided to disconnect users at random times regardless of internet activity. Not to be deterred by the challenge, I started thinking of how to work around this. The login screen looks like this:
I needed something that keeps logging me in automatically. Qt/WebKit was the obvious choice. It would have been trivial had the post URL of the above form not been dynamic (i.e it has a magic session number in the POST url).
So, here’s what I had to do:
1. Keep loading some website at periodic intervals. Check if I get redirected to their login page. It was a bit tricky to use Qt/WebKit to detect a redirect (in fact, there are two redirects); one has to resort to using timers and check if all the redirection has been done and the pages have been completely loaded.
2. Once the page is loaded I need to get the “dynamic” post URL of the form. I could do a grep in the html but that would be too simple
So, I tried evaluateJavaScript that will look in the DOM and return me the post url. Unfortunately, the QVariant returned by evaluateJavaScript() is always null. So, the next strategy was to fill the form details and submit the form entirely using JavaScript. And that worked like a charm
You can find the git repo here (btw, Assembla rocks!).
It struck me later that I probably didn’t need Qt WebKit at all. I think a html/js loading a website periodically in a separate frame and trying to logon if necessary could have worked as well.

I dont understand why do you open a keepalive window if it is actually dowloading.
cheers!
pacodani : I mention the reason in my second paragraph “Now they seem to have decided to disconnect users at random times regardless of internet activity.” So even if something is downloading, they just log me off.
I have a similar problem with my internet. I get it from my university across the road. Occasionally my wireless will drop out and I’ll have to reconnect — this means clicking activate again. Also, sometimes when I activate it will forget who I am and I will need to login again also.
Very annoying! Especially on my mobile phone when I have small browser and have to navigate to my keepalive tab, press activate and then login again with my crazy password they force us to have.
Well, actually I do not understand why you chose that way. You could have done exactly the same with a background deamon written in Python.
- Try to connect to a page every x seconds
- Parse the page to get the title
- If this is the login page, find the form POST URL
- Submit the form.
- Back on track…
Or am I missing something ?
“Since my internet connection is not so fast, I usually download over the night and open a keepalive window.
This worked well up until a couple of months back. Now they seem to have decided to disconnect users at random times regardless of internet activity.”
Sorry, I think it can be misunderstood…
I have a dead simple python script that does this, with a simple regex to get the magic string.
Hmm, now if I could only find an iPhone app which would automatically log me into my wifi system..
Also: re: using QTWebKit — sounds like a case of “when you only have a hammer, everything looks like a nail”.
Personally, i dont like tata wireless or broadband.
Well only good feature that has come from TATA in broadband arena is their plug and surf USB for broadband…they can make it cheaper because there is a huge market out there for that device in the villages of our country//
Hi,
Can you tell me how to use the GIT tool ? , sorry but its a little complicated for people like me who dont know what its about.
as in , how do i compile it ?
@WT: If you’re on Ubuntu: sudo apt-get install git; git clone repo;
It’s of course different if you’re on another OS. In that case, you can google for a quickstart tutorial or refer git-scm.com.
wouldn’t an open gmail window keep polling for new mail and keep the connection alive ?
yesbob, indeed. The problem was that tata wimax disconnects you periodically anyway. (first two lines of second paragraph)