Class: Watir::FrameLocator
- Inherits:
-
TaggedElementLocator
- Object
- Locator
- TaggedElementLocator
- Watir::FrameLocator
- Defined in:
- lib/watir/locator.rb
Instance Attribute Summary collapse
-
#tag ⇒ Object
Returns the value of attribute tag.
Instance Method Summary collapse
- #each_element(tag) ⇒ Object
-
#initialize(container) ⇒ FrameLocator
constructor
A new instance of FrameLocator.
- #locate ⇒ Object
Methods inherited from TaggedElementLocator
Methods inherited from Locator
#match_with_specifiers?, #normalize_specifiers!
Methods included from Watir
_register, _unregister, autoit, #dialog, until_with_timeout
Constructor Details
#initialize(container) ⇒ FrameLocator
Returns a new instance of FrameLocator.
90 91 92 |
# File 'lib/watir/locator.rb', line 90 def initialize(container) @container = container end |
Instance Attribute Details
#tag ⇒ Object
Returns the value of attribute tag.
88 89 90 |
# File 'lib/watir/locator.rb', line 88 def tag @tag end |
Instance Method Details
#each_element(tag) ⇒ Object
94 95 96 97 98 99 100 101 102 103 |
# File 'lib/watir/locator.rb', line 94 def each_element tag frames = @container.document.frames i = 0 @container.document.getElementsByTagName(tag).each do |frame| element = Element.new(frame) document = frames.item(i) yield element, document i += 1 end end |
#locate ⇒ Object
105 106 107 108 109 110 111 112 113 |
# File 'lib/watir/locator.rb', line 105 def locate count = 0 each_element(@tag) do |element, document| next unless match_with_specifiers?(element) count += 1 return element.ole_object, document if count == @specifiers[:index] end # elements nil end |