Find every available HTML element using a CSS selector, an XPath, or a variety of other methods.
Usage
find_elements(x, ...)
# S3 method for class 'selenider_session'
find_elements(
x,
css = NULL,
xpath = NULL,
id = NULL,
class_name = NULL,
name = NULL,
...
)
# S3 method for class 'selenider_element'
find_elements(
x,
css = NULL,
xpath = NULL,
id = NULL,
class_name = NULL,
name = NULL,
...
)
Value
A selenider_elements
object. Note that this is not a list, and you should
be careful with the functions that you use with it. See the advanced usage
vignette for more details:
vignette("advanced-usage", package = "selenider")
.
Details
If more than one method is used to select an element (e.g. css
and
xpath
), the first element which satisfies every condition will be found.
See also
ss()
to quickly select multiple elements without specifying the session.find_element()
to select a single element.selenider_session()
to begin a session.elem_children()
and family to select elements using their relative position in the DOM.elem_filter()
andelem_find()
for filtering element collections.as.list.selenider_elements()
to convert aselenider_elements
object to a list.
Examples
html <- "
<div id='outer-div'>
<div>
<p>Text 1</p>
<p>Text 2</p>
<p>Text 3</p>
</div>
</div>
<div></div>
"
session <- minimal_selenider_session(html)
session |>
find_elements("div")
# Or:
ss("div")
session |>
find_element("#outer-div") |>
find_elements("p")
# The above can be shortened to:
s("#outer-div") |>
find_elements("p")