elem_equal {selenider}R Documentation

Are two elements equivalent?

Description

Checks if two selenider_element objects point to the same element on the page. elem_equal() is equivalent to using ==, but allows you to specify a timeout value if needed.

Usage

elem_equal(x, y, timeout = NULL)

## S3 method for class 'selenider_element'
e1 == e2

Arguments

x, y, e1, e2

selenider_element objects to compare.

timeout

How long to wait for the elements to be present.

Value

TRUE or FALSE.

See Also

Examples


html <- "
<div></div>
<div class='second'>
  <p></p>
</div>
"

session <- minimal_selenider_session(html)

s("div") == ss("div")[[1]]

has_p_child <- function(x) {
  x |>
    elem_children() |> # Direct children
    elem_filter(has_name("p")) |>
    has_at_least(1)
}

ss("div") |>
  elem_find(has_p_child) |>
  elem_equal(s(".second")) # TRUE


[Package selenider version 0.4.0 Index]