Module: Sandwich::World

Defined in:
lib/sandwich/cucumber/world.rb

Instance Method Summary collapse

Instance Method Details

#xpath(unknown_selector) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
15
# File 'lib/sandwich/cucumber/world.rb', line 3

def xpath(unknown_selector)
  kind, selector = if Array === unknown_selector
                     [unknown_selector[0].to_sym, unknown_selector[1]]
                   else
                     [Capybara.default_selector.to_sym, unknown_selector]
                   end

  if kind == :css
    Capybara::XPath.from_css(selector).to_s
  else
    selector
  end
end