Class: Watir::Locators::Element::Validator

Inherits:
Object
  • Object
show all
Defined in:
lib/watir-webdriver/locators/element/validator.rb

Direct Known Subclasses

Button::Validator, TextField::Validator

Instance Method Summary collapse

Instance Method Details

#validate(element, selector) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/watir-webdriver/locators/element/validator.rb', line 5

def validate(element, selector)
  selector_tag_name = selector[:tag_name]
  element_tag_name = element.tag_name.downcase

  if selector_tag_name
    return unless selector_tag_name === element_tag_name
  end

  if element_tag_name == 'input'
    return if selector[:type] && selector[:type] != element.attribute(:type)
  end

  element
end