Class: Watir::InputElementLocator

Inherits:
Locator 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, #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

#eachObject



218
219
220
221
222
223
224
225
226
227
228
229
230
# File 'lib/watir-classic/locator.rb', line 218

def each
  if has_excluding_specifiers?
    locate_elements_by_xpath_css_ole.each do |element|
      yield element
    end
  else
    each_element do |element| 
      next unless type_matches?(element.ole_object) && match_with_specifiers?(element)
      yield element
    end 
  end
  nil
end

#each_elementObject



198
199
200
201
202
203
204
# File 'lib/watir-classic/locator.rb', line 198

def each_element
  elements = locate_by_name || @container.__ole_inner_elements
  elements.each do |object|
    yield create_element object
  end
  nil
end

#locateObject



206
207
208
209
210
211
212
213
214
215
216
# File 'lib/watir-classic/locator.rb', line 206

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
end