[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Mechanize click button

Pradeep

10/5/2007 10:07:00 AM

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

1 Answer

7stud 7stud

10/5/2007 11:09:00 AM

0

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/...

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.

--
Posted via http://www.ruby-....