Class: Watir::IFrameCollection

Inherits:
ElementCollection show all
Defined in:
lib/watir-webdriver/elements/iframe.rb,
lib/watir-webdriver/elements/generated.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



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

def element_class
  IFrame
end

#to_aObject



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

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