From: Lex Williams Date: 2008-09-08T15:17:42+09:00 Subject: Re: find a button using mechanize Li , I wouldn't try to find a form by searching after it's button . Rather , try to search after the name of the input field associated to the button . Here is how I automated http://www.ask.com/web?qsrc=2352&o=0&l=dir&dm=&q=dictionary : require "rubygems" require "mechanize" mech = WWW::Mechanize.new mech.user_agent_alias = "Windows IE 6" mech.get("http://www.ask.com/web?qsrc=2352&o=0&l=dir&dm=&q=dictionary") form = nil form = mech.page.forms.select {|form| form.has_field?("aj_text1")}.first if(form == nil) abort "could not find form" end form.aj_text1 = "abacus" new_page = mech.submit(form) puts new_page.body -- Posted via http://www.ruby-forum.com/.