# Mechanize

**URL:** <https://www.ruby-forum.com/t/mechanize/88902>\
**Category:** Ruby\
**Created:** [March 15, 2007, 2:02pm UTC](https://www.ruby-forum.com/t/mechanize/88902 "2007-03-15T14:02:14Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Manoj\_P\_M](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/35a633/32.png) [@Manoj\_P\_M](https://www.ruby-forum.com/u/Manoj_P_M)\
**Post date:** [March 15, 2007, 2:02pm UTC](https://www.ruby-forum.com/t/mechanize/88902/1 "2007-03-15T14:02:14Z")

</div>

Hi,

I am using mechanize library to do automated form posting. Unfortunately  
it  
doesn’t seem to work for only gumtree.  
Below is the snippet of code that I am using. xxxxx represent the  
acutual  
post id and ziz value. Similar code works for other web applications  
only  
gumtree fails. Is it because, the form has a file upload control in it  
?

require ‘mechanize’  
agent = WWW::Mechanize.new  
agent.user\_agent\_alias = ‘Windows IE 6’  
page = agent.get("  
[Gumtree | Free classified ads from the #1 classifieds site in the UK](http://www.gumtree.com/cgi-bin/email_poster.pl?posting_id=xxxxx&ziz=xxxxx)")

form = page.forms.with.name(“email\_friend”).first

form.from\_email = ‘removed\_email\_address@domain.invalid’  
form.message = “direct http post from code”  
results = agent.submit(form)

Thanks  
Manjo

---

<div class="post-metadata">

**Author:** ![Manoj\_P\_M](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/35a633/32.png) [@Manoj\_P\_M](https://www.ruby-forum.com/u/Manoj_P_M)\
**Post date:** [March 18, 2007, 8:13am UTC](https://www.ruby-forum.com/t/mechanize/88902/2 "2007-03-18T08:13:47Z")

</div>

Hi Manjo,

On Thu, Mar 15, 2007 at 10:01:25PM +0900, Manoj P M wrote:

> Hi,
> 
> I am using mechanize library to do automated form posting. Unfortunately it  
> doesn’t seem to work for only gumtree.  
> Below is the snippet of code that I am using. xxxxx represent the acutual  
> post id and ziz value. Similar code works for other web applications only  
> gumtree fails. Is it because, the form has a file upload control in it ?

How exactly do you know it is failing? Can you be more specific?

Also, you may want to send this message to the mechanize users list:

removed\_email\_address@domain.invalid

Thanks!

---

<div class="post-metadata">

**Author:** ![Manoj\_P\_M](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/35a633/32.png) [@Manoj\_P\_M](https://www.ruby-forum.com/u/Manoj_P_M)\
**Post date:** [April 18, 2007, 9:20am UTC](https://www.ruby-forum.com/t/mechanize/88902/3 "2007-04-18T09:20:32Z")

</div>

m facing the execution timeout issue with myspace the code is working  
fine on console but once you embed the code into my application its  
shwing execution time out.
