has_length {selenider}R Documentation

Does a collection have a certain number of elements?

Description

has_length() and has_size() checks that a collection of HTML elements contains a certain number of elements.

Usage

has_length(x, n)

has_size(x, n)

has_at_least(x, n)

Arguments

x

A selenider_elements object.

n

A numeric vector of possible lengths of x. For has_at_least(), this must be a single number to compare to the length of x.

Details

has_at_least() checks that a collection contains at least n elements.

These functions do not implement a retry mechanism, and only test a condition once. Use elem_expect() or elem_wait_until() to use these conditions in tests.

Value

A boolean value: TRUE or FALSE

See Also

Other conditions: has_attr(), has_css_property(), has_name(), has_text(), is_enabled(), is_present(), is_visible()

Examples


html <- "
<div class='div1'></div>
<div class='div2'></div>
<div class='div3'></div>
"
session <- minimal_selenider_session(html)

has_length(ss("div"), 3)
has_at_least(ss("div"), 2)


[Package selenider version 0.4.0 Index]