module Capybara::Node::Finders
def all(*args, **options, &optional_filter_block)
-
(Capybara::ExpectationNotMet)
- The number of elements found doesn't match the specified conditions
Returns:
-
(Capybara::Result)
- A collection of found elements
Other tags:
- Yieldreturn: - Should the element be considered in the results?
Other tags:
- Yieldparam: element - The element being considered for inclusion in the results
Overloads:
-
all([kind = Capybara.default_selector], locator = nil, options = {}, &filter_block)
-
all([kind = Capybara.default_selector], locator = nil, options = {})
Options Hash:
(**options)
-
wait
(Integer, false
) -- The time to wait for matching elements to become available -
exact
(Boolean
) -- Control whether `is` expressions in the given XPath match exactly or partially -
between
(Range
) -- Number of matches found must be within the given range -
minimum
(Integer
) -- Minimum number of matches that are expected to be found -
maximum
(Integer
) -- Maximum number of matches that are expected to be found -
count
(Integer
) -- Exact number of matches that are expected to be found -
visible
(Boolean, Symbol
) -- Only find elements with the specified visibility: -
exact_text
(String, Boolean
) -- When String the elements contained text must match exactly, when Boolean controls whether the :text option must match exactly -
text
(String, Regexp
) -- Only find elements which contain this text or match this regexp
Parameters:
-
locator
(String
) -- The locator for the specified selector -
kind
(Symbol
) -- Optional selector type (:css, :xpath, :field, etc.) - Defaults to Capybara.default_selector
def all(*args, **options, &optional_filter_block) minimum_specified = options_include_minimum?(options) options = { minimum: 1 }.merge(options) unless minimum_specified options[:session_options] = session_options query = Capybara::Queries::SelectorQuery.new(*args.push(options), &optional_filter_block) result = nil begin synchronize(query.wait) do result = query.resolve_for(self) raise Capybara::ExpectationNotMet, result.failure_message unless result.matches_count? result end rescue Capybara::ExpectationNotMet raise if minimum_specified || (result.compare_count == 1) Result.new([], nil) end end