I have used python to write a code which logs in, this code does the job at my university,
# The selenium.webdriver module provides all the WebDriver implementations. get it online, [I got the module from here][1] from selenium import webdriver # The Keys class provide keys in the keyboard like RETURN, F1, ALT etc. from selenium.webdriver.common.keys import Keys # here, a instance of Firefox WebDriver is created. You can do it for various browsers driver = webdriver.Firefox() # The driver.get method will navigate to a page given by the URL. #WebDriver will wait until the page has fully loaded (that is, the “onload” event has fired) # before returning control to your test or script. # It’s worth noting that if your page uses a lot of AJAX on load then WebDriver may not know when it has completely loaded. so please be patient driver.get("https://192.168.20.1/auth1.html") # The next line is an assertion to confirm that title has “Sonic” word in it: (not really neccesary :p) # This is used to confirm that the webpage is the right one assert "Sonic" in driver.title # we use the 'name' tag to get a handle to the username and password this finds the appropriate box. user = driver.find_element_by_name("userName") passwd = driver.find_element_by_name("pwd") # use the 'send_keys' function to set the "box's" values to your password and username user.send_keys("<your username>") passwd.send_keys("<your password>") # we sumbit the form passwd.send_keys(Keys.RETURN) # we close the window after logging in, the popup which takes care of the 3 hour windows remains open. driver.close()
Now, there are a lot of points to address,
as you might see i have used the url to which i navigate in order to log in as
"https://192.168.20.1/auth1.html" not "https://192.168.20.1/auth.html"
this is as in my college they have set up a frame, basically i couldnt use the 'find_element_by_name' or any such functions in that site. This might vary from institute to institute, check it out by reading your institute's source code thoroughlyalso i have used 'userName' and 'pwd' as the name's of the form box's. This doesnt have to be true for you, check that out too.
Now this code will only log you in if you execute it. You can put it in a loop and put a time delay of 2.5 hours. I am planning to keep it running in the background and if the computer connects to a wifi, the script will be notified, (i could use some help here ) and the code could start with a request to the "authentication page" if there is a 404 error then break other wise run the code. (requests library can help with these things)
#checks for 404 error check=requests.head(url) if check.status_code==404: break
Python is an awesome language, you can work on it further, but i don't think it will be tough to port it to ruby, as selenium is available in ruby too.
please dont hesitate to contact me, as i am working on porting this code and implementing more features to android etc.