I've got a set of pages that I'm trying to scrape with Mechanize in Ruby. On some of the pages, they redirect to a page that wants me to fill out a select-list form and then submit it. The problem is with the button that submits the form, which is an <a>
element. It looks like this:
<a class="css_class" href="#" onclick="RunSomeScript; return false;">
<span>
Enter
</span>
</a>
The magic seems to be happening with the RunSomeScript
script; it is the thing that seems to bypass the redirect page and take me to the page with the data that I'm trying to scrape. Unfortunately, I can't seem to figure out how to properly submit the form with Mechanize. I tried using the Mechanize#click method on the <a>
element by passing in the <a>
's href
attribute to it, but that hasn't seemed to work either. How do I automate a click on this link (i.e., a submission of the form) properly and/or run the RunSomeScript
script in order to submit the form on this redirect page?