Mechanize click button

P

Pradeep

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
 
7

7stud --

Pradeep said:
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,905
Latest member
Kristy_Poole

Latest Threads

Top