Class: Watir::Locators::Element::SelectorBuilder::XPath

Inherits:
Object
  • Object
show all
Defined in:
lib/insite/examples/material_angular_io/watir_mods.rb

Instance Method Summary collapse

Instance Method Details

#lhs_for(_building, key) ⇒ Object

TODO:

Get rid of building



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/insite/examples/material_angular_io/watir_mods.rb', line 9

def lhs_for(_building, key)
  case key
  when :text, 'text'
    'normalize-space()'
  when String
    "@#{key}"
  when :href
    # TODO: change this behaviour?
    'normalize-space(@href)'
  when :type
    # type attributes can be upper case - downcase them
    # https://github.com/watir/watir/issues/72
    XpathSupport.downcase('@type')
  else
    "@#{key.to_s.tr("_", "-")}"
  end
end