From: Lex Williams Date: 2008-09-07T17:35:15+09:00 Subject: Re: find a button using mechanize Lex Williams wrote: > Li Chen wrote: >> Hi all, >> >> I wonder how I find a button in a page(buttons >> #}) >> with mechanize. >> >> Thanks, >> >> Li > > Well , you should iterate through the fields of each form : > > my_form = nil > > catch(:FoundForm) do > agent.page.forms.each do |form| > form.fields.each do |field| > if(field.value == "Go") > my_form = form > throw FoundForm > end > end > end > end > > and now you would have the form containing the button , and could > operate on it. I'm sorry , instead of : throw FoundForm you should have : throw :FoundForm So sorry about that. -- Posted via http://www.ruby-forum.com/.