Method: Capybara::Node::Finders#all
- Defined in:
- lib/capybara/node/finders.rb
- (Capybara::Result) all([kind], locator, options)
Find all elements on the page matching the given selector and options.
Both XPath and CSS expressions are supported, but Capybara does not try to automatically distinguish between them. The following statements are equivalent:
page.all(:css, 'a#person_123')
page.all(:xpath, '//a[@id="person_123"]')
If the type of selector is left out, Capybara uses Capybara.default_selector. It's set to :css by default.
page.all("a#person_123")
Capybara.default_selector = :xpath
page.all('//a[@id="person_123"]')
The set of found elements can further be restricted by specifying options. It's possible to select elements by their text or visibility:
page.all('a', :text => 'Home')
page.all('#menu li', :visible => true)
128 129 130 |
# File 'lib/capybara/node/finders.rb', line 128 def all(*args) resolve_query(Capybara::Query.new(*args)) end |