I encountered an interesting issue with this couple of months ago.
Using mechanize you can select or click form dom elements, submit forms and automate
interaction with websites. But let’s say there’s a case when you select an element
or click on a button – and it’s calling a Javascript function to get the result.
In such cases, you can’t directly get the result by mechanizing the element. Rather
you could just follow two simple steps to get the result,
1 – View the page source or inspect the element using firebug.
2 – Do the exact thing in your ruby script that the javascript function is doing.
for example: If the javascript function is trying to load the data by opening another
Url then open that url in your Ruby script. Here, you can by pass the mechanizing step
and get the result directly!