Module: Watigiri::Locators::MatcherHelpers

Included in:
Button::Matcher, Element::Matcher, TextField::Matcher
Defined in:
lib/watigiri/locators/element/matcher.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#nokogiriObject

Returns the value of attribute nokogiri.



4
5
6
# File 'lib/watigiri/locators/element/matcher.rb', line 4

def nokogiri
  @nokogiri
end

Instance Method Details

#deprecate_text_regexpObject



25
26
27
# File 'lib/watigiri/locators/element/matcher.rb', line 25

def deprecate_text_regexp(*)
  # not applicable to Watigiri
end

#fetch_value(element, how) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/watigiri/locators/element/matcher.rb', line 10

def fetch_value(element, how)
  return super unless nokogiri

  case how
  when :text
    element.inner_text
  when :href
    element.attribute('href')&.to_s&.strip
  when :tag_name
    element.name.downcase
  else
    super.to_s
  end
end

#matching_labels(elements) ⇒ Object



6
7
8
# File 'lib/watigiri/locators/element/matcher.rb', line 6

def matching_labels(elements, *)
  nokogiri ? elements : super
end