ElementCollections#each enumerates all collection items setting the index=>0
----------------------------------------------------------------------------

                 Key: WTR-487
                 URL: http://jira.openqa.org/browse/WTR-487
             Project: Watir
          Issue Type: Bug
          Components: Other
    Affects Versions: 2.0
         Environment: Win 7, Ruby 1.8.7, Watir 2.0.1
            Reporter: bretts


Basically, when i get a enumerate an element collection and then inspect the 
elements in the collection,
they all show index=>0

Steps to reproduce:
1) HTML

<html>
   <table id="a_table">
       <tr><td>boring text</tr></td>
       <tr><td>great text</td></tr>
       <tr><td>the best text ever<td></tr>
   </table>
</html>

2) Code
#------------------------
require 'rubygems'
gem 'watir', '=2.0.1'
require 'watir'

b = Watir::IE.new
b.goto 'http://localhost/test.html'

#get the table collection
table = b.table(:id, 'a_table')

#show the contents of the elements in the collection
table.rows.each { |r| puts r.inspect }
#--results
#<Watir::TableRow:0x4f0b540 located=true how={:index=>0} what=nil>
#<Watir::TableRow:0x4f0b060 located=true how={:index=>0} what=nil>
#<Watir::TableRow:0x4f0ad48 located=true how={:index=>0} what=nil>
#------------------------

3) Summary
Notice that the index for all the items in the collection is set to 0. I 
expected to see the indexes correspond to the index of the row in the table:
#<Watir::TableRow:0x4f0b540 located=true how={:index=>0} what=nil>
#<Watir::TableRow:0x4f0b060 located=true how={:index=>1} what=nil>
#<Watir::TableRow:0x4f0ad48 located=true how={:index=>2} what=nil>



-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.openqa.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        
_______________________________________________
Wtr-development mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/wtr-development

Reply via email to