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.
Arguments
- x, y, e1, e2
selenider_element
objects to compare.- timeout
How long to wait for the elements to be present.
See also
elem_filter()
andelem_find()
for filtering collection of elements.
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