Jump to content

Connect Leeroopedia MCP: Equip your AI agents to search best practices, build plans, verify code, diagnose failures, and look up hyperparameter defaults.

Implementation:Getgauge Taiko Click

From Leeroopedia
Knowledge Sources
Domains Browser_Automation, Form_Interaction
Last Updated 2026-02-12 00:00 GMT

Overview

Concrete tool for simulating mouse click interactions on page elements provided by the Taiko library.

Description

The click() function is Taiko's primary API for performing mouse click actions on web page elements. It accepts a wide variety of selectors -- plain text, CSS selectors, Taiko selector objects (such as link(), button()), or explicit {x, y} coordinate objects -- and performs a mouse click at the target location. The function handles element discovery, scrolling, actionability verification, and mouse event dispatching in a single call.

The implementation supports configurable click behavior through an options object: the mouse button (left, right, or middle), the click count (single, double, or triple), forced clicks that bypass actionability checks, and positional targeting within the element's bounding box. Navigation-aware options allow the caller to wait for page loads triggered by the click.

Usage

Use click() for any mouse click interaction in browser automation scripts: clicking buttons to submit forms, clicking links to navigate between pages, right-clicking to open context menus, double-clicking to select text, or clicking at specific coordinates for canvas-based interactions.

Code Reference

Source Location

  • Repository: Taiko
  • File: lib/taiko.js (L948-953, public API), lib/actions/click.js (L51-93, implementation)

Signature

click(selector, options, ...args) -> Promise<void>

Import

const { click } = require('taiko');

I/O Contract

Inputs

Name Type Required Description
selector string / Selector / Object Yes Target element identifier. Can be plain text (matched against visible text), a Taiko selector (e.g., link('Login'), button('Submit')), a CSS selector string, or a coordinate object {x: number, y: number}.
options Object No Configuration options for the click behavior.
options.button string No Mouse button to use: 'left' (default), 'right', or 'middle'.
options.clickCount number No Number of rapid clicks: 1 (default, single click), 2 (double click), or 3 (triple click).
options.force boolean No If true, bypasses actionability checks (visibility, enabled state, not obscured). Default false.
options.position string No Where to click within the element's bounding box: 'right', 'left', 'topRight', 'topLeft', 'bottomRight', 'bottomLeft'. Defaults to center.
options.waitForNavigation boolean No If true, waits for any navigation triggered by the click to complete. Default true.
options.navigationTimeout number No Maximum time in milliseconds to wait for navigation. Default 30000.
args RelativeSearchElement[] No Proximity selectors to narrow element search (e.g., near('Username'), toRightOf('Label')).

Outputs

Name Type Description
return Promise<void> Resolves when the click action completes successfully. Rejects if the element is not found or actionability checks fail.

Usage Examples

Basic Text Click

// Click a button or link by its visible text
await click('Submit');

Click a Taiko Selector

// Click a link element identified by text
await click(link('Login'));

Coordinate-Based Click

// Click at specific screen coordinates
await click({x: 170, y: 567});

Right-Click

// Right-click to open a context menu
await click('Delete', {button: 'right'});

Double-Click

// Double-click to select a word
await click('some text', {clickCount: 2});

Force Click

// Click an element even if it is covered by an overlay
await click('Hidden Button', {force: true});

Related Pages

Implements Principle

Requires Environment

Uses Heuristic

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment