Skip to content

Instantly share code, notes, and snippets.

@eliotsykes
Last active February 18, 2016 15:57
Show Gist options
  • Save eliotsykes/4e3a54d26bb65dc01130 to your computer and use it in GitHub Desktop.
Save eliotsykes/4e3a54d26bb65dc01130 to your computer and use it in GitHub Desktop.
Capybara Finder Options Cheatsheet

Capybara Options Hash (options) for all, find:

  • text (String, Regexp) — Only find elements which contain this text or match this regexp
  • visible (Boolean, Symbol) — Only find elements with the specified visibility:
    • true - only finds visible elements.
    • false - finds invisible and visible elements.
    • :all - same as false; finds visible and invisible elements.
    • :hidden - only finds invisible elements.
    • :visible - same as true; only finds visible elements.
  • count (Integer) — Exact number of matches that are expected to be found
  • maximum (Integer) — Maximum number of matches that are expected to be found
  • minimum (Integer) — Minimum number of matches that are expected to be found
  • between (Range) — Number of matches found must be within the given range
  • exact (Boolean) — Control whether is expressions in the given XPath match exactly or partially
  • wait (Integer) — default: Capybara.default_max_wait_time — The time to wait for element count expectations to become true

Source: http://www.rubydoc.info/github/jnicklas/capybara/Capybara/Node/Finders#all-instance_method

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment