Jump to content

Connect SuperML | Leeroopedia MCP: Equip your AI agents with best practices, code verification, and debugging knowledge. Powered by Leeroo — building Organizational Superintelligence. Contact us at founders@leeroo.com.

Principle:Teamcapybara Capybara Element Interaction

From Leeroopedia
Knowledge Sources
Domains Testing, DOM_Interaction
Last Updated 2026-02-12 00:00 GMT

Overview

A set of operations that simulate user interactions with DOM elements including clicking, typing, and sending keyboard events.

Description

Element Interaction covers the direct manipulation of DOM elements that simulate real user behavior. After an element is found, these operations trigger browser-level events:

  • click — Simulates a mouse click with optional modifier keys and offset coordinates
  • set — Sets the value of a form element (text input, textarea, etc.)
  • send_keys — Sends keyboard events to the focused element

Each interaction is wrapped in synchronize for auto-waiting and retries on stale element references. The actual browser interaction is delegated to the driver (RackTest for simple HTTP, Selenium for real browser events).

Usage

Use these methods after finding an element with find. Chain directly: find('#btn').click or find(:field, 'Name').set('Alice').

Theoretical Basis

# Abstract interaction pattern (not actual code)
element.click(*modifier_keys, x:, y:, delay:)
  -> synchronize { driver_node.click(keys, options) }
  -> return element (for chaining)

element.set(value, **driver_options)
  -> synchronize { driver_node.set(value, options) }
  -> return element

element.send_keys(*keys)
  -> synchronize { driver_node.send_keys(keys) }
  -> return element

Related Pages

Implemented By

Page Connections

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