I have a small problem. I want to click on some links on a certain website. There are 31 links on the site and each represents a calendarentry. I just want to find some links and by clicking on them the "status" changes and so I can keep this calendar up to date. This is what I've got so far.
require "rubygems"
require "mechanize"
agent = Mechanize.new
agent.get('http://funnysite.com/all_links.php')
available = agent.page.links_with(:href => %r{&status=0})
available.each do |link|
agent.page.link_with(:text => link.text).click
end
Is there a better an clearer way to write this? This code only works "sometimes". Does anyone know a correct implementation of this? Thanx in advance :)