Skip to main content

Overview

Once you’ve located an element, the Element object exposes methods to interact with it. Use these to click, hover, and perform mouse operations that drive your app.

Interaction Methods

click()

Click on the element.
Parameters:
  • action (string, optional) - Type of click: 'click' (default), 'double-click', 'right-click', 'hover', 'mouseDown', 'mouseUp'
Returns: Promise<void> Example:
The element must be found before clicking. The find() method automatically locates the element.

hover()

Hover over the element without clicking.
Returns: Promise<void> Example:

doubleClick()

Double-click on the element.
Returns: Promise<void> Example:

rightClick()

Right-click on the element to open context menu.
Returns: Promise<void> Example:

mouseDown() / mouseUp()

Press or release mouse button on the element (for drag operations).
Returns: Promise<void> Example:

Examples

Basic Element Interaction

Working with Forms

Conditional Interactions

Re-locating Dynamic Elements

Best Practices

If you need to interact with the same element multiple times, reuse the reference: