Overview
Once you’ve located an element, theElement 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.action(string, optional) - Type of click:'click'(default),'double-click','right-click','hover','mouseDown','mouseUp'
Promise<void>
Example:
The element must be found before clicking. The
find() method automatically locates the element.hover()
Hover over the element without clicking.Promise<void>
Example:
doubleClick()
Double-click on the element.Promise<void>
Example:
rightClick()
Right-click on the element to open context menu.Promise<void>
Example:
mouseDown() / mouseUp()
Press or release mouse button on the element (for drag operations).Promise<void>
Example:
Examples
Basic Element Interaction
Working with Forms
Conditional Interactions
Re-locating Dynamic Elements
Best Practices
Reuse element references when possible
Reuse element references when possible
If you need to interact with the same element multiple times, reuse the reference:

