# Mechanize

**URL:** <https://www.ruby-forum.com/t/mechanize/185703>\
**Category:** Rails\
**Created:** [March 24, 2010, 8:29pm UTC](https://www.ruby-forum.com/t/mechanize/185703 "2010-03-24T20:29:51Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nirav\_Parekh](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/7cd45c/32.png) [@Nirav\_Parekh](https://www.ruby-forum.com/u/Nirav_Parekh)\
**Post date:** [March 24, 2010, 8:29pm UTC](https://www.ruby-forum.com/t/mechanize/185703/1 "2010-03-24T20:29:51Z")

</div>

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](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](http://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

---

<div class="post-metadata">

**Author:** ![Nirav\_Parekh](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/7cd45c/32.png) [@Nirav\_Parekh](https://www.ruby-forum.com/u/Nirav_Parekh)\
**Post date:** [March 24, 2010, 11:26pm UTC](https://www.ruby-forum.com/t/mechanize/185703/2 "2010-03-24T23:26:37Z")

</div>

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 D. or Firebug in  
Firefox help you dig around in the form to see what the browser knows  
about the page state.

---

<div class="post-metadata">

**Author:** ![Nirav\_Parekh](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/7cd45c/32.png) [@Nirav\_Parekh](https://www.ruby-forum.com/u/Nirav_Parekh)\
**Post date:** [March 25, 2010, 6:23am UTC](https://www.ruby-forum.com/t/mechanize/185703/3 "2010-03-25T06:23:20Z")

</div>

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

Thank you
