Skip to main content
Right-click an element you’ve located with find(), then pick an item from the menu that opens:

element.rightClick()

Right-clicks the element at the point where find() located it. It’s the same as element.click('right-click').
It takes no parameters.

Errors

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

Right-click at coordinates

The client has no rightClick() method. To right-click a point on the screen, pass action: 'right-click' to testdriver.click():
Prefer element.rightClick(), which keeps working when the layout or screen size changes.

Examples

Rename a file in VS Code

Complete example

tests/context-menu.test.mjs