Question

URL = 'http://public.dep.state.ma.us/SearchableSites2/Search_UST.aspx'
agent = Mechanize.new()
agent.get(URL)

form = agent.page.form_with(:action=>/Search_UST.aspx/)
form.submit(form.button_with(:value=>'Search'))

puts agent.page.body

The above snippet is suppose to submit the form and receives search results page. However, the form does not get submitted. Instead of getting results page, I get the form page as if I did not submit the form.

That's the source page I'm trying submit http://public.dep.state.ma.us/SearchableSites2/Search_UST.aspx

Any suggestion on how to overcome this problem?

Thank you

Was it helpful?

Solution

I can see that Search button has a "doPostBack" action in the onclick. So you will need to parse that and do something with it.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top