Skip to main content
Use fill_form to fill a form in one call. For more control, extract_form_fields lists the fields, dynamic_field_map maps your data onto them, and fill_from_mapping fills them.

page.fill_form

Scan page for form fields, map data to fields via LLM, and fill them. This is the primary SDK interface for form filling. It composes:
  1. extract_form_fields() — scan all fields from the DOM (free)
  2. dynamic_field_map() — one LLM call to map data to fields
  3. validate_mapping() — one LLM call to check user conditions
  4. fill_from_mapping() — fill via CSS selectors with AI fallback
Python only: the TypeScript SDK has no equivalent.
Parameters Returns None Example

page.fill_multipage_form

Fill a multi-page form by looping: fill current page → click next → repeat. Returns the number of pages filled. Stops when:
  • No fillable form fields are found on the current page (e.g., Review page)
  • The next button is not found (last page)
  • max_pages is reached
  • Wall-clock timeout is exceeded
Python only: the TypeScript SDK has no equivalent.
Parameters Returns int Example

page.extract_form_fields

Scan the page for visible form fields using DOM inspection (no LLM). The base scanner handles standard HTML form elements (input, select, textarea) and ARIA role-based groups. Platform-specific passes (e.g., custom listbox buttons, multiselect widgets) are injected at runtime via AgentFunction.get_form_field_extraction_js(). Returns a list of field descriptors.
Python only: the TypeScript SDK has no equivalent.
Returns list[dict[str, Any]] Example

page.dynamic_field_map

Map data to form fields via a single cheap text-only LLM call. One LLM call sees ALL fields + ALL data and produces a complete mapping — no deterministic matching, no caching, no accumulated state.
Python only: the TypeScript SDK has no equivalent.
Parameters Returns dict[int, str \| list \| bool \| None] — Mapping of 0-based field index -> value to fill (or None to skip). Example

page.fill_from_mapping

Fill form fields using a pre-computed mapping from dynamic_field_map. Iterates over the mapping and fills each field using the appropriate browser method based on field type. No LLM calls — pure execution.
Python only: the TypeScript SDK has no equivalent.
Parameters Returns None Example

page.validate_mapping

Validate the field mapping against the user’s prompt/instructions. Makes one LLM call that sees the prompt (user instructions), the form fields, and what was mapped to each field. Returns True if the run should complete, False if it should terminate. This catches user directives like “terminate if you can’t answer the security clearance question” or “never fabricate answers — fail if data is missing for required fields.”
Python only: the TypeScript SDK has no equivalent.
Parameters Returns bool — True to complete, False to terminate. Example

page.fill_autocomplete

Fill an autocomplete input by typing a value and clicking the matching dropdown option. Handles widgets like Google Places, autocomplete location fields, and other autocomplete inputs where typing triggers a dropdown and the user must select an option for the value to persist. The flow:
  1. Clear the field and type the value character-by-character (triggers autocomplete)
  2. Wait for dropdown options to appear
  3. Find the best-matching option by text similarity
  4. Click it so the value is committed
If no dropdown options appear, falls back to the same behavior as page.fill().
Python only: the TypeScript SDK has no equivalent.
Parameters Returns str — The value that was selected from the dropdown, or the typed value if no dropdown appeared. Example