moveToElementCenter method
- WebElement element, {
- int? xOffset,
- int? yOffset,
Moves to element
, with an offset of xOffset
and yOffset
based on the
center of element
.
Implementation
Future<void> moveToElementCenter(WebElement element,
{int? xOffset, int? yOffset}) async {
if (_handler is JsonWireWebDriverHandler) {
final size = await element.size;
await moveTo(
element: element,
xOffset: (xOffset ?? 0) + size.width ~/ 2,
yOffset: (yOffset ?? 0) + size.height ~/ 2);
} else {
await moveTo(element: element, xOffset: xOffset, yOffset: yOffset);
}
}