Skip to main content
Version: 9.0.0

Mouse actions

click

Method allowing to perform a click action.

ParameterTypeDescription
selectorselectorTypeSelector of the element to click.
optionobjectClick action options.

options

ParameterTypeDescription
modifiersKeyModifiers / undefinedKey to press whilst performing a click.

KeyModifiers

ParameterTypeDescription
Altboolean / undefinedIf true, Alt key is press while performing a click.
Controlboolean / undefinedIf true, Control key is press while performing a click.
Metaboolean / undefinedIf true, Meta key is press while performing a click.
Shiftboolean / undefinedIf true, Shift key is press while performing a click.

Basic Usage

await I.click(
"mySelector",
{
modifiers:{
Alt:false,
Control:false,
Meta:false,
Shift:false
}
}
);

doubleClick

Method allowing to perform a double click action.

ParameterTypeDescription
selectorselectorTypeSelector of the element to double-click.
optionobjectDouble-click action options.

options

ParameterTypeDescription
modifiersKeyModifiers / undefinedKey to press whilst performing a doubleclick.

KeyModifiers

ParameterTypeDescription
Altboolean / undefinedIf true, Alt key is press while performing a double click.
Controlboolean / undefinedIf true, Control key is press while performing a double click.
Metaboolean / undefinedIf true, Meta key is press while performing a double click.
Shiftboolean / undefinedIf true, Shift key is press while performing a double click.

Basic Usage

await I.doubleclick(
"mySelector",
{
modifiers:{
Alt:false,
Control:false,
Meta:false,
Shift:false
}
}
);

middleClick

Method allowing to perform a middle-click action.

ParameterTypeDescription
selectorselectorTypeSelector of the element to middle-click.
optionobjectMiddle click action options.

options

ParameterTypeDescription
modifiersKeyModifiers / undefinedKey to press whilst performing a middle click.

KeyModifiers

ParameterTypeDescription
Altboolean / undefinedIf true, Alt key is press while performing a middle click.
Controlboolean / undefinedIf true, Control key is press while performing a middle click.
Metaboolean / undefinedIf true, Meta key is press while performing a middle click.
Shiftboolean / undefinedIf true, Shift key is press while performing a middle click.

Basic Usage

await I.middleClick(
"mySelector",
{
modifiers:{
Alt:false,
Control:false,
Meta:false,
Shift:false
}
}
);

rightClick

Method allowing to perform a right-click action.

ParameterTypeDescription
selectorselectorTypeSelector of the element to right-click.
optionobjectRight click action options.

options

ParameterTypeDescription
modifiersKeyModifiers / undefinedKey to press whilst performing a right click.

KeyModifiers

ParameterTypeDescription
Altboolean / undefinedIf true, Alt key is press while performing a right click.
Controlboolean / undefinedIf true, Control key is press while performing a right click.
Metaboolean / undefinedIf true, Meta key is press while performing a right click.
Shiftboolean / undefinedIf true, Shift key is press while performing a right click.

Basic Usage

await I.rightClick(
"mySelector",
{
modifiers:{
Alt:false,
Control:false,
Meta:false,
Shift:false
}
}
);

hover

Method allowing to hover over an element with the mouse cursor.

ParameterTypeDescription
selectorselectorTypeSelector of the element to hover.
optionobjectHover action options.

options

ParameterTypeDescription
modifiersKeyModifiers / undefinedKey to press whilst hovering.

KeyModifiers

ParameterTypeDescription
Altboolean / undefinedIf true, Alt key is press while hovering.
Controlboolean / undefinedIf true, Control key is press while hovering.
Metaboolean / undefinedIf true, Meta key is press while hovering.
Shiftboolean / undefinedIf true, Shift key is press while hovering.

Basic Usage

await I.hover(
"mySelector",
{
modifiers:{
Alt:false,
Control:false,
Meta:false,
Shift:false
}
}
);

mouseUp

Method allowing to stop pressing a mouse button.

ParameterTypeDescription
optionobjectMouse up action options.

options

ParameterTypeDescription
buttonleft / middle / rightMouse buttons to release.
modifiersKeyModifiers / undefinedKey to press while releasing mouse buttons.

KeyModifiers

ParameterTypeDescription
Altboolean / undefinedIf true, Alt key is press while hovering.
Controlboolean / undefinedIf true, Control key is press while hovering.
Metaboolean / undefinedIf true, Meta key is press while hovering.
Shiftboolean / undefinedIf true, Shift key is press while hovering.

Basic Usage

await I.mouseUp(); //Stop pressing all mouse buttons.
await I.mouseUp({
button: `left`,
{
modifiers:{
Alt:false,
Control:false,
Meta:false,
Shift:false
}
}
});

mouseDown

Method allowing to keep pressing a mouse button.

ParameterTypeDescription
optionobjectMouse down action options.

options

ParameterTypeDescription
xnumberAbscissa of the aimed cursor position.
ynumberOrdinate of the aimed cursor position.
buttonleft / middle / rightMouse buttons to press.
modifiersKeyModifiers / undefinedKey to press while pressing mouse buttons.

KeyModifiers

ParameterTypeDescription
Altboolean / undefinedIf true, Alt key is press while hovering.
Controlboolean / undefinedIf true, Control key is press while hovering.
Metaboolean / undefinedIf true, Meta key is press while hovering.
Shiftboolean / undefinedIf true, Shift key is press while hovering.

Basic Usage

await I.mouseDown({
x :100,
y:100,
button: `left`,
{
modifiers:{
Alt:false,
Control:false,
Meta:false,
Shift:false
}
}
});

mouseMove

Method allowing to move the mouse cursor.

ParameterTypeDescription
xnumberHorizontal mouse pointer coordinates that define the aimed position.
ynumberHorizontal mouse pointer coordinates that define the aimed position.
optionobjectMouse move action options.

options

ParameterTypeDescription
buttonleft / middle / rightMouse buttons to press.
modifiersKeyModifiers / undefinedKey to press while moving the mouse cursor.

KeyModifiers

ParameterTypeDescription
Altboolean / undefinedIf true, Alt key is press while hovering.
Controlboolean / undefinedIf true, Control key is press while hovering.
Metaboolean / undefinedIf true, Meta key is press while hovering.
Shiftboolean / undefinedIf true, Shift key is press while hovering.

Basic Usage

await I.mouseMove(
x:100,
y:100,
{
modifiers:{
Alt:false,
Control:false,
Meta:false,
Shift:false
}
}
);

drag

Method allowing to drag an element to a specific position.

ParameterTypeDescription
selectorselectorTypeSelector of the element to drag.
dragOffsetXnumberHorizontal mouse pointer coordinates that define a point where the action is performed.
dragOffsetYnumberVertical mouse pointer coordinates that define a point where the action is performed.
optionsDragToSelectorOptionsDragging action options.

options

ParameterTypeDescription
destinationOffsetXnumberHorizontal mouse pointer coordinates that define a point where the action is stopped.
destinationOffsetYnumberVertical mouse pointer coordinates that define a point where the action is stopped.
offsetXnumberHorizontal mouse pointer coordinates that define a point where the action is started.
offsetYnumberVertical mouse pointer coordinates that define a point where the action is started.
modifiersKeyModifiers / undefinedKey to press while performing the action.
speednumberValue defining the execution speed of the action.

KeyModifiers

ParameterTypeDescription
Altboolean / undefinedIf true, Alt key is press while hovering.
Controlboolean / undefinedIf true, Control key is press while hovering.
Metaboolean / undefinedIf true, Meta key is press while hovering.
Shiftboolean / undefinedIf true, Shift key is press while hovering.

Basic Usage

  await I.drag(
"mySelector",
100,
100,
{
destinationOffsetX: 10,
destinationOffsetY: 10,
modifiers :{
Alt:false,
Control:false,
Meta: false,
Shift: false
},
offsetX: 10,
offsetY: 10,
speed:15
}
);

dragToSelector

Method allowing to drag an element to another specific element.

ParameterTypeDescription
selectorselectorTypeSelector of the element to drag.
destinationSelectorselectorTypeSelector of the destination element of the dragging action.
optionsDragToSelectorOptionsDragging action options.

options

ParameterTypeDescription
destinationOffsetXnumberHorizontal mouse pointer coordinates that define a point where the action is stopped.
destinationOffsetYnumberVertical mouse pointer coordinates that define a point where the action is stopped.
offsetXnumberHorizontal mouse pointer coordinates that define a point where the action is started.
offsetYnumberVertical mouse pointer coordinates that define a point where the action is started.
modifiersKeyModifiers / undefinedKey to press while performing the action.
speednumberValue defining the execution speed of the action.

moveCursorToSelector

Method allowing to move the mouse cursor to a specific element.

ParameterTypeDescription
selectornumberSelector of the element to move the mouse cursor to.
offsetXnumberHorizontal mouse pointer coordinates that define a point where the action is performed.
offsetYnumberVertical mouse pointer coordinates that define a point where the action is performed.