Move the mouse by an offset of the specified Web Element ID or relative to the current mouse cursor, if no element is specified. If an element is provided but no offset, the mouse will be moved to the center of the element.

If an element is provided but no offset, the mouse will be moved to the center of the element. If the element is not visible, it will be scrolled into view.

Syntax

.moveTo([webElementId], xoffset, yoffset, [callback])
.moveTo(null, xoffset, yoffset, [callback])

Parameters

Name Type description
webElementId
Optional
string

The Web Element ID assigned to the element to move to. If not specified or is null, the offset is relative to current position of the mouse.

xoffset number

X offset to move to, relative to the top-left corner of the element. If not specified, the mouse will move to the middle of the element.

yoffset number

Y offset to move to, relative to the top-left corner of the element. If not specified, the mouse will move to the middle of the element.

callback
Optional
function

Optional callback function to be called when the command finishes.

Usage

this.demoTest = function (browser) {
  browser.moveTo(null, 110, 100);
};