Class: Watir::FrameLocator

Inherits:
TaggedElementLocator show all
Defined in:
lib/watir-classic/locator.rb

Constant Summary

Constants included from Watir

VERSION

Instance Method Summary collapse

Methods inherited from Locator

#create_element, #document, #each, #has_excluding_specifiers?, #initialize, #locate_by_id, #match?, #match_class?, #match_with_specifiers?, #normalize_specifiers, #type_matches?

Methods included from XpathLocator

#direct_children, #element_by_css, #element_by_xpath, #elements_by_css, #elements_by_xpath, #xmlparser_document_object

Methods included from Exception

message_for_unable_to_locate

Methods included from Watir

options, options=, options_file, options_file=

Constructor Details

This class inherits a constructor from Watir::Locator

Instance Method Details

#each_element(tag) ⇒ Object



156
157
158
159
160
161
162
163
164
165
# File 'lib/watir-classic/locator.rb', line 156

def each_element(tag)
  frames = @container.page_container.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

#locateObject



167
168
169
170
171
172
173
# File 'lib/watir-classic/locator.rb', line 167

def locate
  count = Watir::IE.base_index - 1
  each do |frame|
    count += 1
    return frame.ole_object, frame.document if count == @specifiers[:index]
  end
end

#locate_elements_by_xpath_css_oleObject



175
176
177
178
179
180
181
182
183
184
185
186
# File 'lib/watir-classic/locator.rb', line 175

def locate_elements_by_xpath_css_ole
  super.map do |frame|
    frame = create_element frame
    each_element(frame.tag_name) do |frame_with_document|
      if frame_with_document == frame
        frame = frame_with_document
        break
      end
    end
    frame
  end
end