has_length()
and has_size()
checks that a collection of HTML elements
contains a certain number of elements.
Arguments
- x
A
selenider_elements
object.- n
A numeric vector of possible lengths of
x
. Forhas_at_least()
, this must be a single number to compare to the length ofx
.
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.
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)