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



71
72
73
# File 'lib/watir-webdriver/elements/iframe.rb', line 71

def element_class
  IFrame
end

#to_aObject



62
63
64
65
66
67
68
69
# File 'lib/watir-webdriver/elements/iframe.rb', line 62

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