Class: Watir::InputElementLocator
- Defined in:
- lib/watir/locator.rb
Instance Method Summary collapse
- #each ⇒ Object
- #each_element ⇒ Object
-
#initialize(container, types, klass) ⇒ InputElementLocator
constructor
A new instance of InputElementLocator.
- #locate ⇒ Object
-
#match?(element, how, what) ⇒ Boolean
return true if the element matches the provided how and what.
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
Constructor Details
#initialize(container, types, klass) ⇒ InputElementLocator
Returns a new instance of InputElementLocator.
193 194 195 196 197 |
# File 'lib/watir/locator.rb', line 193 def initialize container, types, klass @container = container @types = types @klass = klass || Element end |
Instance Method Details
#each ⇒ Object
219 220 221 222 223 224 225 |
# File 'lib/watir/locator.rb', line 219 def each each_element do |element| next unless @types.include?(element.type) && match_with_specifiers?(element) yield element end nil end |
#each_element ⇒ Object
199 200 201 202 203 204 205 |
# File 'lib/watir/locator.rb', line 199 def each_element elements = locate_by_name || @container.__ole_inner_elements elements.each do |object| yield create_element object end nil end |
#locate ⇒ Object
207 208 209 210 211 212 213 214 215 216 217 |
# File 'lib/watir/locator.rb', line 207 def locate el = locate_by_id return el if el return locate_by_xpath_css_ole 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 |
#match?(element, how, what) ⇒ Boolean
return true if the element matches the provided how and what
228 229 230 231 232 233 234 235 236 237 |
# File 'lib/watir/locator.rb', line 228 def match? element, how, what begin attribute = element.send(how) rescue NoMethodError raise MissingWayOfFindingObjectException, "#{how} is an unknown way of finding an <INPUT> element (#{what})" end what.matches(attribute) end |