Skip to contents

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.

Usage

is_visible(x)

is_displayed(x)

is_hidden(x)

is_invisible(x)

Arguments

x

A selenider_element object.

Value

A boolean value: TRUE or FALSE.

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

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