From: Li Chen Date: 2008-09-07T19:51:06+09:00 Subject: Re: find a button using mechanize Lex Williams wrote: >> 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 Hi Lex, I follow your script but it prints out nothing. I guess the inner loop is not right. Accroding to this line :{buttons #} I change the inner loop.I get all the buttons and I am able to set the value for @name or @value. But I still have a problem: I can't print the whole line out as {buttons #} I only print out the some part of it as # BTW: where can I find some info about relationship among form/fields/buttons and other backgrounds ? Thanks, Li ###################### page.forms.each do |form| form.buttons.each do |button| if(button.value == 'Go') puts button.name puts button.value button.name='1' puts button.name puts button end end end ###output nil Go 1 # nil Go 1 # nil Go 1 # nil Go 1 # >Exit code: 0 -- Posted via http://www.ruby-forum.com/.