is_visible()
and is_displayed()
checks that an element can be seen on the
page, while is_invisible()
and is_hidden()
checks the opposite. All
functions throw an error if the element is not in the DOM.
Details
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_length()
,
has_name()
,
has_text()
,
is_enabled()
,
is_present()
Examples
html <- "
<div style='visibility:hidden;'>Content 1</div>
<div style='display:none'>Content 2</div>
<div>Content 3</div>
"
session <- minimal_selenider_session(html)
is_visible(s("div")) # FALSE
is_invisible(ss("div")[[2]]) # TRUE
is_visible(ss("div")[[3]]) # TRUE