elem_hover() moves the mouse over to an HTML element and hovers over it,
without actually clicking or interacting with it.
elem_focus() focuses an HTML element.
See also
Other actions:
elem_click(),
elem_scroll_to(),
elem_select(),
elem_set_value(),
elem_submit()
Examples
html <- "
<button onmouseover = settext()></button>
<p class = 'text'></p>
"
js <- "
function settext() {
const element = document.getElementsByClassName('text').item(0);
element.innerHTML = 'Button hovered!';
}
"
session <- minimal_selenider_session(html, js = js)
elem_expect(s(".text"), has_exact_text(""))
s("button") |>
elem_hover()
elem_expect(s(".text"), has_text("Button hovered!"))
s("button") |>
elem_focus()