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 Form Field Filling

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

Overview

A form interaction pattern that locates text fields or text areas by accessible identifiers and sets their values.

Description

Form Field Filling combines element finding and value setting into a single semantic operation. Instead of manually finding a field and calling set, this pattern uses the :fillable_field selector to locate inputs by name, id, test_id, placeholder, or label text — matching how real users identify form fields. The pattern:

  1. Finds the field using the :fillable_field selector with the given locator
  2. Optionally filters by current value (currently_with option)
  3. Calls set on the found element with the provided value and driver-specific fill options

This approach is resilient to DOM structure changes because it uses semantic identifiers rather than CSS selectors.

Usage

Use this for any text input or textarea interaction. Prefer fill_in over find(:field).set as it provides better error messages and semantic matching.

Theoretical Basis

# Abstract fill_in flow (not actual code)
fill_in(locator, with: value):
  element = find(:fillable_field, locator)
  element.set(value, **fill_options)
  return element

Related Pages

Implemented By

Page Connections

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