Clicks a web element using simulated mouse events, with optional human-like movement and offsets. Handles visibility checks, scrolling, and special option elements.
async def click(
self,
x_offset: int = 0,
y_offset: int = 0,
hold_time: float = 0.1,
humanize: bool = False,
):
"""
Click element using simulated mouse events.
Args:
x_offset: Horizontal offset from element center.
y_offset: Vertical offset from element center.
hold_time: Duration to hold mouse button down (used when humanize=False).
humanize: When True and a Mouse instance is available, uses humanized
Bezier curve movement from the current tracked position to the
element center before clicking. When False, dispatches raw CDP
mousePressed/mouseReleased events directly.
Raises:
ElementNotVisible: If elem
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search 40K more like it.
Get a free API key