You can look through \ruby\lib\ruby\gems\1.8\gems\watir-1.6.2\lib\watir
\collections.rb for the types of collections that watir recognizes, as
well as a good idea on how to add your own.

-Dylan

On Sep 2, 7:18 am, manar alalfi <alalfi.ma...@gmail.com> wrote:
> Thanks a lot for you all. The solution provided by Mark works pretty
> well, but I still have a question on how to generlize this to collect
> all other type of page elements, such as ( hidden, submit, radio,..),
> I tried things like, ie.hidden.each..., or the others and wont work!,
> So is there any other way to do this?
>
> Regards
> Manar
>
> On Sep 2, 6:17 am, "Mark Anderson" <mander...@drillinginfo.com> wrote:
>
> > I don't think your call to #collect is doing what you expect.  For each text
> > field, puts is printing the details and returning nil.  textF is then an
> > array of nils with the same length as the number of text_fields.  
>
> > The documentation of the #collect command is available at:
> >        http://www.ruby-doc.org/core/classes/Array.html#M002187
>
> > It looks to me like you want all of the text fields.  I think what you are
> > looking for is something like:
>
> > ie.text_fields.each {|tf|
> >         if tf.value != 'null'
> >                 puts tf.name
> >         end
>
> > }
>
> >                                         /\/\ark
>
> > > -----Original Message-----
> > > From: watir-general@googlegroups.com [mailto:watir-
> > > gene...@googlegroups.com] On Behalf Of manar alalfi
> > > Sent: Tuesday, September 01, 2009 12:23 PM
> > > To: Watir General
> > > Subject: [wtr-general] Check value of anonymous text field
>
> > > Hello,
>
> > > I want to print the name attribute of a text field in a page
>
> > > #collect Text fields elaments
> > > textF =  ie.text_fields.collect {|tf | puts tf}
>
> > > # iterate to check for none_null_ name text field
> > > for tf in textF do
> > >   if ie.text_field(:name, tf.name).value != 'null'
> > >            puts  tf.name.to_s
> > >   end
>
> > > but the code gives an error:
> > > 3: undefined method `name' for nil:NilClass (NoMethodError)
>
> > > any help?
>
> > > Thanks
>
> > > __________ Information from ESET NOD32 Antivirus, version of virus
> > > signature database 4387 (20090901) __________
>
> > > The message was checked by ESET NOD32 Antivirus.
>
> > >http://www.eset.com
>
> > > __________ Information from ESET NOD32 Antivirus, version of virus
> > > signature database 4388 (20090902) __________
>
> > > The message was checked by ESET NOD32 Antivirus.
>
> > >http://www.eset.com
>
> > __________ Information from ESET NOD32 Antivirus, version of virus signature
> > database 4388 (20090902) __________
>
> > The message was checked by ESET NOD32 Antivirus.
>
> >http://www.eset.com-Hide quoted text -
>
> > - Show quoted text -
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To post to this group, send email to watir-general@googlegroups.com
Before posting, please read the following guidelines: 
http://wiki.openqa.org/display/WTR/Support
To unsubscribe from this group, send email to 
watir-general-unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/watir-general
-~----------~----~----~----~------~----~------~--~---

Reply via email to