Class: Watir::Locators::TextField::Validator

Inherits:
Element::Validator show all
Defined in:
lib/watir-webdriver/locators/text_field/validator.rb

Constant Summary collapse

VALID_TEXT_FIELD_TAGS =
%w[input textarea]

Instance Method Summary collapse

Instance Method Details

#validate(element, selector) ⇒ Object



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

def validate(element, selector)
  element_tag_name = element.tag_name.downcase

  if element.tag_name.downcase == 'textarea'
    warn "Locating textareas with '#text_field' is deprecated. Please, use '#textarea' method instead."
  end
  return unless VALID_TEXT_FIELD_TAGS.include?(element_tag_name)

  element
end