Skip to main content
Click an element you’ve located with find():
Or chain it straight onto find():

element.click(action)

Clicks the element at the point where find() located it.

Parameters

ClickAction
default:"click"
The mouse action to perform:
  • 'click': a left click
  • 'double-click': a double click, same as doubleClick()
  • 'right-click': a right click, same as rightClick()
  • 'hover': move the mouse there without clicking, same as hover()
  • 'mouseDown' and 'mouseUp': press or release the button, for dragging. See mouseDown().

Errors

Throws an ElementNotFoundError if find() didn’t locate the element. Check found() first when the element might not be there:

testdriver.click(options)

Clicks a point on the screen by its coordinates. Prefer element.click(), which keeps working when the layout or screen size changes.

Parameters

object
required
The older form testdriver.click(x, y, action) still works. Use the options object in new tests.

Examples

Open a context menu

Open a file

Drag an item

Complete example

tests/login.test.mjs