Class: Watir::TaggedElementLocator

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

Direct Known Subclasses

FormLocator, FrameLocator

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, #locate_elements_by_xpath_css_ole, #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



135
136
137
138
139
# File 'lib/watir-classic/locator.rb', line 135

def each_element(tag)
  document.getElementsByTagName(tag).each do |ole_object|
    yield create_element ole_object
  end
end

#locateObject



141
142
143
144
145
146
147
148
149
150
151
152
# File 'lib/watir-classic/locator.rb', line 141

def locate
  el = locate_by_id
  return el if el
  return locate_elements_by_xpath_css_ole[0] if has_excluding_specifiers?

  count = Watir::IE.base_index - 1
  each do |element|
    count += 1
    return element.ole_object if count == @specifiers[:index]
  end # elements
  nil
end