Class: Watir::FrameLocator
Instance Method Summary
collapse
#match?
Methods inherited from Locator
#create_element, #document, #has_excluding_specifiers?, #locate_by_id, #locate_by_xpath_css_ole, #match_with_specifiers?, #normalize_specifiers!, #set_specifier
Methods included from Watir
until_with_timeout
Constructor Details
#initialize(container) ⇒ FrameLocator
Returns a new instance of FrameLocator.
142
143
144
|
# File 'lib/watir/locator.rb', line 142
def initialize(container)
super(container, Frame::TAG, Frame)
end
|
Instance Method Details
#each ⇒ Object
157
158
159
160
161
162
163
164
165
|
# File 'lib/watir/locator.rb', line 157
def each
@tag.each do |t|
each_element(t) do |element|
next unless match_with_specifiers?(element)
yield element
end
end
nil
end
|
#each_element(tag) ⇒ Object
146
147
148
149
150
151
152
153
154
155
|
# File 'lib/watir/locator.rb', line 146
def each_element tag
frames = document.frames
i = 0
document.getElementsByTagName(tag).each do |ole_object|
frame = create_element ole_object
frame.document = frames.item(i)
yield frame
i += 1
end
end
|
#locate ⇒ Object
167
168
169
170
171
172
173
174
175
176
177
|
# File 'lib/watir/locator.rb', line 167
def locate
return locate_by_xpath_css_ole if has_excluding_specifiers?
count = Watir::IE.base_index - 1
each do |frame|
count += 1
return frame.ole_object, frame.document if count == @specifiers[:index]
end
end
|