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.
Arguments
- x
A
selenider_element
object.- js
Whether to hover over the element using JavaScript.
- timeout
How long to wait for the element to exist.
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()