Dynamic Form Filling with Stagehand Agent

Intelligently fill out forms from natural language or unstructured data using Stagehand Agent

Demo preview
TypeScript
Source code
npx create-browser-app --template dynamic-form-filling

Get started with Stagehand Agent-driven dynamic form filling

This template uses a Stagehand Agent with Browserbase to autonomously fill out a form using natural language or unstructured data. Stagehand extracts relevant form questions and the agent fills the form with the closest options for radio buttons, dropdowns, and checkboxes—even when the wording doesn’t exactly match. Once all required fields are complete, it submits the form automatically.

Steps

  1. Start a Browserbase session with Stagehand and open the target form URL
  2. Create a Stagehand Agent with a system prompt tailored for form filling
  3. Provide natural language details (e.g., trip description) as the instruction input
  4. Agent fills all required fields, selecting the closest option for radio buttons, dropdowns, and checkboxes
  5. Clicks submit to complete the form submission