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)

By default Capybara's waiting behavior will wait up to
`Capybara.default_max_wait_time` seconds for matching elements to be
available and then return an empty result if none are available. It is
possible to set expectations on the number of results located and Capybara
will raise an exception if the number of elements located don't satisfy
the specified conditions. The expectations can be set using

When String the elements contained text must match exactly, when Boolean
controls whether the :text option must match exactly

normalize_ws(Boolean)
— default:
Capybara.default_normalize_ws
—

Whether the `text`/`exact_text` options are compared against elment text
with whitespace normalized or as returned by the driver

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.

obscured(Boolean)
—

Only find elements with the specified obscured state:

true - only find elements whose centerpoint is not in the viewport or is
obscured by another non-descendant element.

false - only find elements whose centerpoint is in the viewport and is not
obscured by other non-descendant elements.

id(String, Regexp)
—

Only find elements with an id that matches the value passed

class(String, Array<String>, Regexp)
—

Only find elements with matching class/classes. + Absence of a class can be
checked by prefixing the class name with ! + If you need to check for
existence of a class name that starts with ! then prefix with !! +
“`class:['a', '!b', '!!!c'] # limit to elements
with class 'a' and '!c' but not class 'b'“`

style(String, Regexp, Hash)
—

Only find elements with matching style. String and Regexp will be checked
against text of the elements `style` attribute, while a Hash will be
compared against the elements full style

exact(Boolean)
—

Control whether `is` expressions in the given XPath match exactly or
partially

If the driver is capable of executing JavaScript, this method will wait for
a set amount of time and continuously retry finding the element until
either the element is found or the time expires. The length of time this
method will wait is controlled through default_max_wait_time.

If the driver is capable of executing JavaScript, this method will wait for
a set amount of time and continuously retry finding the element until
either the element is found or the time expires. The length of time this
method will wait is controlled through default_max_wait_time.

When String the elements contained text must match exactly, when Boolean
controls whether the :text option must match exactly

normalize_ws(Boolean)
— default:
Capybara.default_normalize_ws
—

Whether the `text`/`exact_text` options are compared against elment text
with whitespace normalized or as returned by the driver

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.

obscured(Boolean)
—

Only find elements with the specified obscured state:

true - only find elements whose centerpoint is not in the viewport or is
obscured by another non-descendant element.

false - only find elements whose centerpoint is in the viewport and is not
obscured by other non-descendant elements.

id(String, Regexp)
—

Only find elements with an id that matches the value passed

class(String, Array<String>, Regexp)
—

Only find elements with matching class/classes. + Absence of a class can be
checked by prefixing the class name with ! + If you need to check for
existence of a class name that starts with ! then prefix with !! +
“`class:['a', '!b', '!!!c'] # limit to elements
with class 'a' and '!c' but not class 'b'“`

style(String, Regexp, Hash)
—

Only find elements with matching style. String and Regexp will be checked
against text of the elements `style` attribute, while a Hash will be
compared against the elements full style

exact(Boolean)
—

Control whether `is` expressions in the given XPath match exactly or
partially

Find a button on the page. This can be any <input> element of type
submit, reset, image, button or it can be a <button> element. All
buttons can be found by their id, name, Capbyara.test_id attribute, value,
or title. <button> elements can also be found by their text content,
and image <input> elements by their alt attribute

If the driver is capable of executing JavaScript, this method will wait for
a set amount of time and continuously retry finding the element until
either the element is found or the time expires. The length of time this
method will wait is controlled through default_max_wait_time.

If the driver is capable of executing JavaScript, this method will wait for
a set amount of time and continuously retry finding the element until
either the element is found or the time expires. The length of time this
method will wait is controlled through default_max_wait_time.

Find a form field on the page. The field can be found by its name, id or
label text.

If the driver is capable of executing JavaScript, this method will wait for
a set amount of time and continuously retry finding the element until
either the element is found or the time expires. The length of time this
method will wait is controlled through default_max_wait_time.

If the driver is capable of executing JavaScript, this method will wait for
a set amount of time and continuously retry finding the element until
either the element is found or the time expires. The length of time this
method will wait is controlled through default_max_wait_time.

Find the first element on the page matching the given selector and options.
By default `first` will wait up to `Capybara.default_max_wait_time` seconds
for matching elements to appear and then raise an error if no matching
element is found, or `nil` if the provided count options allow for empty
results.

If the driver is capable of executing JavaScript, this method will wait for
a set amount of time and continuously retry finding the element until
either the element is found or the time expires. The length of time this
method will wait is controlled through default_max_wait_time.