Principle:Getgauge Taiko Click Interaction
| Knowledge Sources | |
|---|---|
| Domains | Browser_Automation, Form_Interaction |
| Last Updated | 2026-02-12 00:00 GMT |
Overview
Technique for simulating mouse click interactions on page elements in browser automation.
Description
Click simulation involves finding a target element, scrolling it into view, performing actionability checks (visible, enabled, not covered), and dispatching mouse events at the element's center coordinates. This is one of the most fundamental interactions in browser automation, as nearly every user workflow involves clicking on buttons, links, or other interactive elements.
The click process follows a well-defined sequence: first the target element is located using a selector (text content, CSS selector, or explicit coordinates). Once found, the element is scrolled into the viewport if necessary. Actionability checks then verify that the element is visible, enabled, and not obscured by overlapping elements. Finally, mouse events are dispatched at the calculated center point of the element's bounding box.
Taiko supports several click variants to cover different interaction scenarios. Left-click is the default and most common operation. Right-click opens context menus. Middle-click can trigger special browser behaviors such as opening links in new tabs. Double-click and triple-click handle text selection and similar interactions that require rapid successive clicks. Coordinate-based clicking allows interaction at precise screen positions when element-based targeting is impractical.
Usage
Use click interaction whenever a browser automation script needs to:
- Submit forms by clicking submit buttons
- Navigate by clicking links or navigation elements
- Toggle UI state by clicking toggles, accordions, or expandable sections
- Trigger actions such as delete, edit, or download via button clicks
- Open context menus via right-click
- Select text via double-click or triple-click
- Interact with canvas or map elements via coordinate-based clicking
Theoretical Basis
The click simulation follows this sequence:
- Actionability checks -- Verify the target element is visible in the DOM, is enabled (not disabled), and is not covered by another element (e.g., a modal overlay).
- Scroll into view -- If the element is outside the current viewport, scroll until it becomes visible. This uses
Element.scrollIntoView()or equivalent CDP commands. - Get bounding box -- Retrieve the element's position and dimensions via the CDP DOM domain to determine its screen coordinates.
- Calculate center -- Compute the center point of the element's bounding box. This is the default click target unless a specific position option is provided (e.g.,
topRight,bottomLeft). - Dispatch mouse events -- Send
mousePressedandmouseReleasedevents via the CDPInputdomain at the calculated coordinates. The event sequence mimics a real user interaction, including proper button identifiers and click counts.
For coordinate-based clicks, steps 1-4 are skipped and events are dispatched directly at the specified {x, y} position.
The force option bypasses actionability checks, which is useful for elements that are technically obscured but still clickable (e.g., elements behind transparent overlays).