Skip to main content
Move the mouse onto an element without clicking. Use it to reveal tooltips, dropdown menus and hover styles.

element.hover()

Moves the mouse to the point where find() located the element. It’s the same as element.click('hover').
It takes no parameters.

Errors

Throws an ElementNotFoundError if find() didn’t locate the element. See click() for how to check found() first.

testdriver.hover(options)

Moves the mouse to a point on the screen by its coordinates. Prefer element.hover(), which keeps working when the layout or screen size changes.
object
required
The older form testdriver.hover(x, y) still works. Use the options object in new tests.

Examples

Read a tooltip

Check a hover style

Drag an item

hover() moves the mouse while the button is held down by mouseDown():

Complete example

tests/hover.test.mjs