Mclick
Bun

method

WebView.click

x: number,
y: number,
options?: ClickOptions
): Promise<void>;

Click at the given viewport coordinates.

Fires native pointerdown/mousedown/pointerup/mouseup/click events with isTrusted: true. The promise resolves after WebContent has processed the full event sequence (including all JS handlers) — no polling, WebKit's own mouse-queue-drain barrier.

selector: string,
): Promise<void>;

Wait for an element to become actionable, then click its center.

Actionability is checked page-side at rAF rate: the element must be attached, have non-zero size, be in the viewport, be stable (bounding box unchanged for 2 consecutive frames), and be the topmost element at its center point (not obscured). Once actionable, a native click fires at the center coordinates.

// Waits for the button to appear and stop animating, then clicks.
await view.click("#submit");

Referenced types

interface ClickOptions

  • button?: 'left' | 'right' | 'middle'
  • clickCount?: 2 | 1 | 3

    Number of clicks (1 = single, 2 = double, 3 = triple).

  • modifiers?: Modifier[]

    Modifier keys to hold during the click.

interface ClickSelectorOptions

  • button?: 'left' | 'right' | 'middle'
  • clickCount?: 2 | 1 | 3

    Number of clicks (1 = single, 2 = double, 3 = triple).

  • modifiers?: Modifier[]

    Modifier keys to hold during the click.

  • timeout?: number

    Maximum time in milliseconds to wait for the element to become actionable (attached, visible, stable for 2 frames, not obscured).