Mechanize click button

Hi All,

I’m using “agent = WWW::Mechanize.new”
I have 3 buttons in a page with ‘value’ attribute. But I do not have
‘name’ attribute. How to click on a particular button? ?
No submit button present in that form.

Can anyone help on this!!!

Thanks in Advance

Regards,
Pradeep

Pradeep Ramakrishnan wrote:

Hi All,

I’m using “agent = WWW::Mechanize.new”
I have 3 buttons in a page with ‘value’ attribute. But I do not have
‘name’ attribute. How to click on a particular button? ?
No submit button present in that form.

There are usually alternate ways of locating a button besides the name
attribute. See if you can get something like this to work:

target_button = form.fields.find {|field| field.value == ‘text here’}

Or, if you go to the documentation here(which is horrible):

http://mechanize.rubyforge.org/mechanize/

There is a class called GlobalForm that has all kinds of attributes with
one of them being: buttons. Maybe you can get something to work that
way.