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

Était-ce utile?

La 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.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top