[wtr-general] Re: Check value of anonymous text field

2009-09-03 Thread manar alalfi
Thanks Dylan for the reply, what I really want is, filling all text fields with a random text when they (are empty). This piece of code in it's current state do this when text fields are not empty. I tried to remove the second condition and it gives me an exception as it was not able to set the

[wtr-general] Re: Check value of anonymous text field

2009-09-03 Thread manar alalfi
Thanks Dylan, Thats worked! . Manar On Sep 3, 10:02 am, Dylan mej...@gmail.com wrote: You have some fields on your page that are hidden, so Watir throughs that error when you tell it to write to a hidden field. Watir can deal with this, but you have to add a require

[wtr-general] Re: Check value of anonymous text field

2009-09-02 Thread manar alalfi
Thanks Jen, but nothing has changed, and the same error still there!. I guess it is another way to iterate a collection. On Sep 1, 7:52 pm, Jin ben@gmail.com wrote: hi,guy, try in this way: textF.each do |tf| ... end On Sep 2, 1:22 am, manar alalfi alalfi.ma...@gmail.com wrote:

[wtr-general] Re: Check value of anonymous text field

2009-09-02 Thread Mark Anderson
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:

[wtr-general] Re: Check value of anonymous text field

2009-09-02 Thread Tony
Hi ... The error is here textF = ie.text_fields.collect {|tf | puts tf} - returns null. collect {|item|block} - return an array of things returned by the block. Hence you see the undefined method `name' for nil:NilClass (NoMethodError) try this - #collect Text fields elaments textF =

[wtr-general] Re: Check value of anonymous text field

2009-09-02 Thread manar alalfi
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

[wtr-general] Re: Check value of anonymous text field

2009-09-02 Thread Dylan
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

[wtr-general] Re: Check value of anonymous text field

2009-09-02 Thread Dylan
Is there a reason you're changing how you access them between the two codes? in your first one (where you can find the text field) you have puts tf.name, where in the second one where you cant find it you have ie.text_field(:name, tf.name).set watir Why not just stick with tf.set watir ?

[wtr-general] Re: Check value of anonymous text field

2009-09-01 Thread Jin
hi,guy, try in this way: textF.each do |tf| ... end On Sep 2, 1:22 am, manar alalfi alalfi.ma...@gmail.com wrote: 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