Taiko
Documentation

Home / API Reference

mouseAction

Performs the given mouse action on the given coordinates. This is useful in performing actions on canvas.

Examples

await mouseAction('press', {x:0,y:0})
await mouseAction('move', {x:9,y:9})
await mouseAction('release', {x:9,y:9})
await mouseAction($("#elementID"),'press', {x:0,y:0})
await mouseAction($(".elementClass"),'move', {x:9,y:9})
await mouseAction($("testxpath"),'release', {x:9,y:9})
await mouseAction('release', {x:9, y:9}, {navigationTimeout: 30000})

Parameters


action

Action to be performed on the canvas


coordinates

Coordinates of a point on canvas to perform the action.


options

options.waitForNavigation boolean

Wait for navigation after the click. Default navigation timeout is 30 seconds, to override pass { navigationTimeout: 10000 } in options parameter.

Default value
true

options.navigationTimeout number

Navigation timeout value in milliseconds for navigation after click.

Default value
30000

options.waitForEvents Array<string>

Events available to wait for ['DOMContentLoaded', 'loadEventFired', 'networkAlmostIdle', 'networkIdle', 'firstPaint', 'firstContentfulPaint', 'firstMeaningfulPaint', 'targetNavigated']

Default value
[]

options.waitForStart number

time to wait for navigation to start. Accepts time in milliseconds.

Default value
100

options.force boolean

Set to true to perform action on hidden/disabled elements.

Default value
false

Returns

This API does not return any values