Skip to contents

Get the number of elements in a HTML element collection, waiting for the parent elements (if any) to exist before returning a value.

length() and elem_size() can be used interchangeably, the only difference being that elem_size() allows you to specify a timeout.

Usage

elem_size(x, timeout = NULL)

# S3 method for selenider_elements
length(x)

Arguments

x

A selenider_elements object.

timeout

The time to wait for the parent of x (if any) to exist.

Value

An integer representing the number of elements in the collection.

See also

Other properties: elem_attr(), elem_css_property(), elem_name(), elem_text()

Examples

html <- "
<div></div>
<div></div>
<div></div>
<div></div>
"
session <- minimal_selenider_session(html)

ss("div") |>
  length()