Method: Capybara::Session#has_xpath?

Defined in:
lib/capybara/session.rb

#has_xpath?(path, options = {}) ⇒ Boolean

Returns:

  • (Boolean)


139
140
141
142
143
144
145
146
147
148
149
150
151
# File 'lib/capybara/session.rb', line 139

def has_xpath?(path, options={})
  wait_conditionally_until do
    results = all(:xpath, path, options)

    if options[:count]
      results.size == options[:count]
    else
      results.size > 0
    end
  end
rescue Capybara::TimeoutError
  return false
end