moveTo method Null safety
- {WebElement? element,
- int? xOffset,
- int? yOffset,
- bool absolute = false}
Move the mouse.
If element
is specified and xOffset
and yOffset
are not, will move
the mouse to the center of the element
.
If xOffset
and yOffset
are specified, will move the mouse that distance
from its current location.
If all three are specified, the behavior will be different
for W3C and JsonWire. For W3C, it will use element
center as the
origin, while for JsonWire, it will use element
top left corner.
To get a consistent behavior across browsers, you can try
moveToElementCenter and moveToElementTopLeft to specify the origin you
would like to use.
All other combinations of parameters are illegal.
Special notes for W3C, if the destination is out of the current viewport, an 'MoveTargetOutOfBounds' exception will be thrown.
Implementation
Future<void> moveTo(
{WebElement? element,
int? xOffset,
int? yOffset,
bool absolute = false}) =>
_client.send(
_handler.mouse.buildMoveToRequest(
elementId: element?.id,
xOffset: xOffset,
yOffset: yOffset,
absolute: absolute),
_handler.mouse.parseMoveToResponse);