tags:

views:

14

answers:

1

I'm faced with an interesting task:

Our transport guys have to monitor a 3rd-party webpage the entire day, clicking every 5 seconds on a button, to refresh the page and get available transport slots. The slots section is only updated when the button is clicked. When slots become available, the available slot label changes from "0" to "1", or "2", depending on the amount of open slots...

Is there any way of writing a script that would automatically click on the button, and raise an alert when that specific value on the page changes? Maybe some sort of UI Testing framework that could automated this?

Any suggestions?

A: 

Pressing a button on such webpage always boils down to a HTTP request, which you can do with pretty much plain Ruby's net/http. However, I guess there is some authentication going on there, so cookies may have to be preserved. For such uses, Mechanize is very nice library. It relies on Nokogiri, and pages you get are really easy to scan for such changes, as number of open slots you need.

Without more detailed information about the pages you need to scrape, this is pretty much all the advice you can get.

Mladen Jablanović