Class: Watir::IFrameCollection

Inherits:
ElementCollection show all
Defined in:
lib/watir-webdriver/elements/iframe.rb,
lib/watir-webdriver/elements/html_elements.rb

Direct Known Subclasses

FrameCollection

Instance Method Summary collapse

Methods inherited from ElementCollection

#[], #each, #first, #initialize, #last, #length

Constructor Details

This class inherits a constructor from Watir::ElementCollection

Instance Method Details

#to_aObject



66
67
68
69
70
71
72
73
# File 'lib/watir-webdriver/elements/iframe.rb', line 66

def to_a
  # In case `#all_elements` returns empty array, but `#elements`
  # returns non-empty array (i.e. any frame has loaded between these two calls),
  # index will return nil. That's why `#all_elements` should always
  # be called after `#elements.`
  element_indexes = elements.map { |el| all_elements.index(el) }
  element_indexes.map { |idx| element_class.new(@parent, tag_name: @selector[:tag_name], index: idx) }
end