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
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
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:
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:
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 =
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
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
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 ?
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