Hover over Objects

I.hoverOn

Hover on an element.

For image / icon elements, we'd strongly recommend that setting an aria-label for the target element, use I.click using the label. This will also help make your application more friendly to humans using accessibility tools.

Usage

I.hoverOn(target);

Parameters

ParameterTypeRemarks
targetstring

Keyword to identify the element to click.
This is case-insensitive.

Example(s)

// using element's label, based on e.g. the element's text, tooltip, title, ARIA labels, etc.
I.hoverOn("Help")          // Hover on the element labelled "Help"

// using css selector
I.hoverOn("#menu-mobile")  // Hover on element with the id "menu-mobile"
I.hoverOn(".menu")         // Hover on element with the class ".menu"

// using xpath
I.hoverOn("//img[@class='question-card']") // Hover on image with the class "question-card"
Last Updated: