click method
This method scrolls element into view if needed, and then uses page.mouse
to click in the center of the element.
If the element is detached from DOM, the method throws an error.
Parameters:
button
: Defaults to MouseButton.leftclickCount
: Defaults to 1delay
: Time to wait betweenmousedown
andmouseup
. Defaults to 0.
Returns Future which resolves when the element is successfully clicked. Future gets rejected if the element is detached from DOM.
Implementation
Future<void> click(
{Duration? delay, MouseButton? button, int? clickCount}) async {
await _scrollIntoViewIfNeeded();
var point = await _clickablePoint();
await page.mouse
.click(point, delay: delay, button: button, clickCount: clickCount);
}