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

#element_classObject



58
59
60
# File 'lib/watir-webdriver/elements/iframe.rb', line 58

def element_class
  IFrame
end

#to_aObject



49
50
51
52
53
54
55
56
# File 'lib/watir-webdriver/elements/iframe.rb', line 49

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