class Watir::Locators::TextField::SelectorBuilder::XPath

Public Instance Methods

additional_string() click to toggle source
# File lib/watir/locators/text_field/selector_builder/xpath.rb, line 13
def additional_string
  return '' if @adjacent

  type_string(@selector.delete(:type))
end
negative_type_text() click to toggle source
# File lib/watir/locators/text_field/selector_builder/xpath.rb, line 37
def negative_type_text
  Watir::TextField::NON_TEXT_TYPES.map { |type|
    lhs = lhs_for(:type, downcase: true)
    rhs = SelectorBuilder::XpathSupport.downcase(SelectorBuilder::XpathSupport.escape(type))
    "#{lhs}!=#{rhs}"
  }.join(' and ')
end
tag_string() click to toggle source
# File lib/watir/locators/text_field/selector_builder/xpath.rb, line 19
def tag_string
  @selector[:tag_name] = 'input' unless @adjacent
  super
end
text_string() click to toggle source
# File lib/watir/locators/text_field/selector_builder/xpath.rb, line 6
def text_string
  return super if @adjacent

  @built[:text] = @selector.delete(:text) if @selector.key?(:text)
  ''
end
type_string(type) click to toggle source
# File lib/watir/locators/text_field/selector_builder/xpath.rb, line 24
def type_string(type)
  if type.eql?(true)
    "[#{negative_type_text}]"
  elsif Watir::TextField::NON_TEXT_TYPES.include?(type)
    msg = "TextField Elements can not be located by type: #{type}"
    raise LocatorException, msg
  elsif type.nil?
    "[not(@type) or (#{negative_type_text})]"
  else
    "[#{process_attribute(:type, type)}]"
  end
end