elem_hover {selenider}R Documentation

Hover over an element

Description

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.

Usage

elem_hover(x, js = FALSE, timeout = NULL)

elem_focus(x, timeout = NULL)

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.

Value

x, invisibly.

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()


[Package selenider version 0.4.0 Index]