moveToElementTopLeft method

void moveToElementTopLeft(
  1. WebElement element, {
  2. int? xOffset,
  3. int? yOffset,
})

Moves to element, with an offset of xOffset and yOffset based on the top left corner of element.

Implementation

void moveToElementTopLeft(WebElement element, {int? xOffset, int? yOffset}) {
  if (_handler is W3cWebDriverHandler) {
    final size = element.size;
    moveTo(
        element: element,
        xOffset: (xOffset ?? 0) - size.width ~/ 2,
        yOffset: (yOffset ?? 0) - size.height ~/ 2);
  } else {
    moveTo(element: element, xOffset: xOffset, yOffset: yOffset);
  }
}