Mechanize

Hi

I am trying to submit an asp form using Mechanize.

I have to parse this site in order to get the results http://www.vitranexpress.com/home/CombinedHome.aspx

So for this I have to log in the site which I was successful using Mechanize. Once you logged in you have to select the Link “Rate Quoter”. Again using mechanize I got the page that this link pointed to. There is a form which I need to submit to get the shipping charges.

To submit that you need to enter the destination zip code. With actual site when you enter the destination zip code it passes an ajax request to the server and returns the area matching the zip code.

Once that is done you enter the weight and class.

With mechanize I was able to set the destination zip code, weight and class. But when I try to submit it returns me the same form every time.

I searched the net for help. I found that the asp.net uses a field “__EVENTTARGET” to be set to submit a form. I tried doing that too but it didn’t worked.

I would like to know how do I do this.

Thank you, Nirav

I'm not going to create an account to snoop around so you'll need to give more information so we can give better suggestions. Without seeing the HTML for the form and cookies and the URL they send you it's hard to say, however they could be storing a session key in a hidden field or in a cookie. They could also be doing something in Javascript, so you'll need to figure out which one it is.

Mechanize is a good starting point, so dig around in what they're sending your browser.Browser tools like Web Developer or Firebug in Firefox help you dig around in the form to see what the browser knows about the page state.

Thank you for your reply, I’ll dig for some unknown area using Mechanize.

Thank you