browser-form-fill
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseBrowser Form Fill
浏览器表单填充
Fill a form using a structured field map (). When a entry exists for the host, use it to resolve field names → CSS selectors automatically; otherwise resolve via the page accessibility snapshot.
{"first_name": "Ada", "company": "..."}browser-templates通过结构化字段映射()填充表单。如果针对当前主机存在条目,则自动使用其解析字段名称→CSS选择器;否则通过页面可访问性快照进行解析。
{"first_name": "Ada", "company": "..."}browser-templatesWhen to use
使用场景
- Submitting a known form (signup, contact, checkout) where field names are stable.
- Re-using a stored template for a recurring submission.
- Authoring a new template for a site by recording the resolved selectors.
- 提交已知表单(注册、联系、结账),且字段名称稳定时。
- 为重复提交复用已存储的模板。
- 通过记录解析后的选择器为网站创建新模板。
Steps
操作步骤
- Open a recorded session via .
browser-record - Resolve selectors:
- Template path (): pull
--template <name>from{field_name → selector}.browser-templates - Snapshot path: call , walk the accessibility tree, match each input's accessible name / label to the field map keys.
browser_snapshot
- Template path (
- AIDefence PII gate: every value in the field map passes before any keystroke; record
aidefence_has_piiin the session manifest. Do not record the values themselves in the trajectory; record only the field names + a redacted placeholder.pii_in_form: true - Fill with /
browser_fill/browser_type/browser_selectper input type.browser_check - Submit if : locate the submit button via the snapshot,
--submit, thenbrowser_clickfor navigation.browser_wait - Persist the template if a new mapping was discovered:
bash
npx -y @claude-flow/cli@latest memory store --namespace browser-templates \ --key "<host>:<form-name>" \ --value "{field_map:{...}, submit_selector:..., post_submit_url_pattern:...}" - Verify post-submit state if a verification snippet was provided in the field map's key.
_assert
- 通过打开录制会话。
browser-record - 解析选择器:
- 模板路径():从
--template <name>中提取browser-templates映射。{字段名称→选择器} - 快照路径:调用,遍历可访问性树,将每个输入框的可访问名称/标签与字段映射的键进行匹配。
browser_snapshot
- 模板路径(
- AIDefence PII网关:在输入任何按键之前,字段映射中的每个值都会经过检查;在会话清单中记录
aidefence_has_pii。请勿在轨迹中记录值本身,仅记录字段名称+脱敏占位符。pii_in_form: true - 根据输入类型填充:使用/
browser_fill/browser_type/browser_select进行填充。browser_check - 若指定则提交:通过快照定位提交按钮,调用
--submit,然后browser_click等待页面导航。browser_wait - 若发现新映射则保存模板:
bash
npx -y @claude-flow/cli@latest memory store --namespace browser-templates \ --key "<host>:<form-name>" \ --value "{field_map:{...}, submit_selector:..., post_submit_url_pattern:...}" - 若字段映射的键中提供了验证代码段,则验证提交后的状态。
_assert
Caveats
注意事项
- Trajectory steps for fills MUST redact values. The PII gate is the contract.
- For inputs that require typing simulation (e.g., autocomplete reactions), use (simulates keystrokes) rather than
browser_type(sets value programmatically). Record which one was used in the trajectory step.browser_fill - Multi-step forms are a sequence of invocations; chain them via the same session id.
browser-form-fill - If the form has a CAPTCHA, surface the request to the user — do not attempt to bypass.
- 填充操作的轨迹步骤必须对值进行脱敏。PII网关是核心约束。
- 对于需要模拟输入的输入框(如自动补全响应),请使用(模拟按键输入)而非
browser_type(通过编程方式设置值)。在轨迹步骤中记录使用的方法。browser_fill - 多步骤表单需通过多次调用完成;通过同一个会话ID将它们串联起来。
browser-form-fill - 若表单包含CAPTCHA,请将请求提交给用户处理——请勿尝试绕过。