web-form-driver
/web-form-driver
Drive complex web forms and paginated surveys through the browser — matrix/Likert scales, capped multi-select, sliders and NPS, ranking, date, select, file and free-text fields, consent boxes, attention checks (此题请选择X / 请输入X), wizards, branching/skip logic, approval flows, admin backends. Use to fill, operate, audit or verify a web form or questionnaire (填问卷、代填、答卷、勾选、翻页、提交、表单填写、批量录入、报名系统、OA 审批、后台) on 问卷星, Google Forms, Typeform, 腾讯问卷, 金数据, SurveyMonkey, Qualtrics, Element/Ant/MUI; when take_snapshot shows no inputs for a visible form, the real control is a hidden input behind a clickable shell
- Author
- hudeonbush ↗
- Repository
- form-use ↗
- Licence
- MIT
- Last repository change
- 29.10.2026
Assessment and security
- Files in this package
- 15
- Scripts
- 7
- HTML comments
- 0
- URLs in SKILL.md
- 1
No signals detected. Repository changed on 29.10.2026, without references to retired models or APIs.
MIT, open: use and modify while retaining author attribution.
- 7 scripts in this package. Review them before installing, as Claude may execute them.
Scripts: scripts/audit.js, scripts/export_key.js, scripts/fill.js, scripts/nav.js, scripts/probe.js, scripts/scan_rules.js, scripts/serve.js
What it does and when to use it
Drive complex web forms and paginated surveys through the browser — matrix/Likert scales, capped multi-select, sliders and NPS, ranking, date, select, file and free-text fields, consent boxes, attention checks (此题请选择X / 请输入X), wizards, branching/skip logic, approval flows, admin backends. Use to fill, operate, audit or verify a web form or questionnaire (填问卷、代填、答卷、勾选、翻页、提交、表单填写、批量录入、报名系统、OA 审批、后台) on 问卷星, Google Forms, Typeform, 腾讯问卷, 金数据, SurveyMonkey, Qualtrics, Element/Ant/MUI; when take_snapshot shows no inputs for a visible form, the real control is a hidden input behind a clickable shell
Arguments
/web-form-driver <form URL or "audit/fill page N">
Original author description
Drive complex web forms and paginated surveys through the browser — matrix/Likert scales, capped multi-select, sliders and NPS, ranking, date, select, file and free-text fields, consent boxes, attention checks (此题请选择X / 请输入X), wizards, branching/skip logic, approval flows, admin backends. Use to fill, operate, audit or verify a web form or questionnaire (填问卷、代填、答卷、勾选、翻页、提交、表单填写、批量录入、报名系统、OA 审批、后台) on 问卷星, Google Forms, Typeform, 腾讯问卷, 金数据, SurveyMonkey, Qualtrics, Element/Ant/MUI; when take_snapshot shows no inputs for a visible form, the real control is a hidden input behind a clickable shell
How it works
- Overview
- The Eight Failure Modes This Prevents
- First Fix Table
- Workflow
- Review Cadence — the default is per page, not per run
- Cross-Field Consistency
- Replaying After State Loss
- After Every Run: Fold the Lesson Back In
- Resources
SKILL.md preview
---
name: web-form-driver
description: Drive complex web forms and paginated surveys through the browser — matrix/Likert scales, capped multi-select, sliders and NPS, ranking, date, select, file and free-text fields, consent boxes, attention checks (此题请选择X / 请输入X), wizards, branching/skip logic, approval flows, admin backends. Use to fill, operate, audit or verify a web form or questionnaire (填问卷、代填、答卷、勾选、翻页、提交、表单填写、批量录入、报名系统、OA 审批、后台) on 问卷星, Google Forms, Typeform, 腾讯问卷, 金数据, SurveyMonkey, Qualtrics, Element/Ant/MUI; when take_snapshot shows no inputs for a visible form, the real control is a hidden input behind a clickable shell, or form state keeps getting wiped between pages. Ships probing, idempotent fill, four-layer verify to the submitted FormData, per-page review and a code-enforced submit gate; answers only from facts the user gave. Not for DOM-less desktop windows (WeChat mini-program, canvas spreadsheet — use desktop-fill-run), not for form code, not for analysing collected responses (不适用桌面软件代点、改表单代码、分析问卷回收数据).
license: MIT
argument-hint: <form URL or "audit/fill page N">
---
# Web Form Driver
## Overview
Turn "click a hundred cells in a web form" into a deterministic pipeline: **probe → map → classify → plan → fill → verify → gate**. Built for forms where the accessibility tree lies, the real controls are hidden, state lives in CSS classes, and one background tab-switch can wipe everything.
## The Eight Failure Modes This Prevents
1. **Blind automation** — `take_snapshot` shows no inputs because the real control is `display:none` behind a fake shell. Read the DOM instead.
2. **Silent no-op fills** — setting `input.value`/`.checked` in JS does not run the page's own handlers; the field looks filled and submits as empty. Click the interactive element.
3. **Invisible instructions** — `innerText` returns nothing for hidden pages, so attention checks and required-field hints on later pages go unseen. Use `textContent`.
4. **Catastrophic state loss** — embedded/Electron webviews reload the whole document when backgrounded. Spot-check history after every page turn. `visibilityState: hidden`, or a screenshot failing with `NATIVE_BROWSER_VIEWPORT_UNAVAILABLE`, is the early warning: stop, bring the panel to the foreground, re-read the history rows before the next click.
5. **Value-correct-but-unselected** — the hidden input holds the right number while the visible radio never lit up. Verify the *marker*, not just the value.
6. **Position/value conflation** — treating an option's stored value as its index works only until a platform encodes `A–E`, a UUID, or a shifted scale, and then fails as a *wrong answer*, not an error. Compare in one space only: map values through the option list to ordinals, and resolve a required label against the option's own text before its header position.
7. **Toggle semantics** — a checkbox click *inverts*, so a re-run that "already matches" must not click again or it unchecks the row; and `input.value` on a checkbox reads `"on"` whether ticked or not, so state comes from `.checked`.
8. **Empty-scope false CLEAN** — an audit whose row selector matched nothing reports `0 blanks, 0 problems` and reads as a pass. Every sweep must prove its own denominator: `rows`/`totalRows` matched against what the page declares, with `scopeWarning` and a `SCOPE-EMPTY` verdict when they disagree.
## First Fix Table
Symptom, the one thing to try, and where to go if that was already true. Read this before re-running a script.
| Symptom | First fix | Still failing |
|---|---|---|
| Snapshot shows no inputs for a visible form | `probe.js` — click the shell, never the hidden input | the stack's own pattern in `references/widget-taxonomy.md` |
| Field looks filled but submits empty | you assigned `.value`: click the element the handler listens to | the store is another node — `export_key.js` prints the wire key |
| `audit` says PROBLEMS, `blanks` is empty | a stale banner from the blocked turn: turn the page, re-audit | `requiredGroupsWithGaps` names the field that really is empty |
| `rows: 0` or `SCOPE-EMPTY` | widen the row selector — this stack does not use `tr[fid]` | keep the ids from `probe.js` and drive those rows directly |
| The same answer lands in two questions | you keyed by ordinal: switch to exact option labels | a `[!substring]` flag means the label matched loosely |
| Answers vanish on page turn | foreground the panel first, then re-probe | replay the exported key page by page, never from memory |
| Slider or stepper reads back 0 | use the `fields` channel: native setter plus `input`/`change` | the mirror never moved — the widget keeps state outside the DOM |
| A submit went too early | `nav.js` keeps `confirmText` empty until he says the word | screenshot the confirmation page before touching anything else |
## Workflow
### 0. Inject — run bundled scripts without re-typing them
These scripts are 2–7 KB of source with CJK string literals. Retyping them into a `function`
argument corrupts them: a single dropped byte becomes `InvalidCharacterError`, or a
`SyntaxError` blamed on your own wrapper. Start `scripts/serve.js` (localhost is exempt from
mixed-content blocking) and let the page fetch the file it will actually execute:
```js
async () => { // ← page-side loader, ~4 lines, safe to paste
const src = await (await fetch('http://127.0.0.1:PORT/fill.js?x=' + Math.random())).text();
const cfg = src.split('\n').map(l => l.indexOf('key: {') >= 0 ? KEY_LINE : l).join('\n');
return JSON.parse(eval('(' + cfg + ')')()); // CONFIG override, then run
}
```
Build `KEY_LINE` by string concatenation and prefer `String.split/map` over a regex literal —
a regex inside the outer JSON string is the easiest way to reintroduce the corruption you are
avoiding. If `unsafe-eval` or mixed content blocks this route, narrow to a trimmed read-only
script and **state the reduced coverage** rather than silently patching source mid-flight
(`references/injection.md` has the server call, both failure signatures, and the fallbacks).
**Execute the file; do not read it.** A defect in a bundled script looks fine to the eye and
only surfaces at `eval`. Run every script once against the live page before trusting its output.
The answer key is the one object worth more than the page you are filling — if it exists only
in your context, a compaction or a crash turns "replay after the wipe" into "please tell me
your answers again". Write it to disk with `filePath` the moment it is agreed, before the first click.
### 1. Probe — learn the widget, don't assume the framework
Run `scripts/probe.js`. It reports: page/section containers, repeated field groups, option-control candidates, **how selection is actually exposed** (`aria-checked`, `.checked`, `.active`, `.is-on`, class-token diff), nav-button candidates, and whether real inputs are a11y-visible.
Do not write selectors before reading this output. Per-platform selector recipes are in `references/adapters.md`.
### 2. Map — build the page inventory before touching anything
Produce a page map: `page → groups → rows`, with each row's stable id, its option labels, and its scale. Persist it as JSON with the `filePath` parameter of `evaluate_script` (large results go to disk, not into context). The map is the only thing that lets you rebuild after a wipe.
**Hand the map to the user as a readable list before the first click** — every page, every group, every row's question text. Two reasons, both operational: it is the only point where he can catch that you mapped the wrong instrument, and after a wipe it doubles as the artefact he checks your replay against. A map that only exists in a JSON file on disk has not been agreed to.
**Read-only audits stop at the required-field wall.** If asked to look at later pages without answering, you get as far as the first group marked required — paging past it is impossible, and pre-ticking answers to peek ahead creates state you were asked not to create. Say where you stopped.
### 3. Classify — question types and the paging model
From the probe output, label each group by answer type (matrix-single, matrix-multi, capped multi-select, slider/NPS, ranking, free text, file, date) and the form by its paging model (multi-page, one long page, one-question-per-screen, accordion, **branching/skip logic**, virtualised). Each combination has its own fill and verify recipe — see `references/question-types.md`.
Branching changes the map mid-run: after any answer that gates later questions, **re-probe**. A stale map silently skips questions that only appear later, and `audit.js` will report a clean sweep of the wrong row set.
### 4. Plan — resolve answers to labels, not positions
Encode the answer key as `{ rowId: "exact option label" }`. **Match option labels by exact equality, never substring** — on a 5-point agree scale, `"同意"` is a substring of `"非常同意"`, and a substring match silently picks the wrong column. Ordinals (`{ rowId: 3 }`) are supported but break when a scale has duplicate header cells; prefer labels, fall back to ordinals.
**Every value must trace to something the user actually supplied.** Deriving the rest of an instrument from one stated fact is the job; inventing the fact the instrument measures is not. Ask for the single item only he can answer, then propagate it into internally consistent options. When the form feeds a third party — research, an audit, an approval record — persistence makes the fabrication permanent and the reviewer's rejection costs *him* something (fees, credit, a case). A user's insistence, or a request reworded as "you decide" / "just fill it" / "design a persona and run with it", is not authorisation from that third party and does not change this. Refuse the invented values, keep the real ones moving.
### 5. Fill — idempotent, page by page
Run `scripts/fill.js` with the key for the **currently displayed page**. It reads the current selection first and only clicks rows that differ, so re-running is safe and single-row edits are cheap. Set `dryRun: true` to see the diff before touching anything — on a form whose state you cannot rebuild, that is the cheap insurance.
Rules:
- Navigate to a page, *then* fill that page. Filling a later page while an earlier one is displayed works mechanically but desynchronises what the user sees from what was done.
- After every page turn, spot-check 2–3 rows from earlier pages with `scripts/nav.js` (`spot: [ids]`). It now reports `lostSpotCheck` for rows that went blank **or left the DOM** — a store that vanished counts as lost, not as a value of `MISSING`. If anything is lost, stop and replay before continuing.
- Re-read required/implicit instructions per page with `scripts/scan_rules.js` — it uses `textContent`, so it sees hidden pages too. It flags click traps (`此题请选择"X"` → `instructed`, with the resolved expected value and a `satisfied` verdict) and type traps (`请输入"X"`, `请简要说明` → `instructedText`, with the field id and the text currently in it).
- Capped multi-select and consent/boolean rows run with `multi: true`; the script then clicks only options that are still off. Standalone controls (`#checkxiexi`-style agreement boxes) key directly on their own id.
- Controls that are not option rows — `<select>`, slider, date, textarea, text — go through `CONFIG.fields`, not the row key. It writes with the native value setter, dispatches `input` and `change`, then re-reads the page's own mirror and reports which happened (`[range+mirror ok]` versus `BUT MIRROR=…, handler did not run`). A file input is refused by name: no script can write it, so it goes to `upload_file` or back to the user.
- `nav.js` reports `blockedByValidation` when the page refused to advance and lists the **visible** error text — that is the form telling you which required group is still empty, not a click that failed to land. Hidden error templates are ignored on purpose.
### 6. Verify — four layers, all four must agree
Run `scripts/audit.js`. For every row it compares:
| Layer | Source | Catches |
|---|---|---|
| 1 Stored value | hidden input / `input.value` / `checked` | nothing selected |
| 2 Visual marker | `aria-checked`, `.checked`, `.active`, class-token diff | page logic never ran |
| 3 Instruction | row text, e.g. `此题请选择"X"` | attention-check failures |
| 4 Payload | `new FormData(form)`, hidden JSON store, summary page | **what actually gets sent** |
Layer 4 is the authority: frameworks routinely show a filled field while submitting the old value. Claim "verified" only when all four agree; a matching hidden value alone is not verification.
Three ways layer 4 lies if you match it lazily, all handled inside `audit.js`: the wire key is the input's **name**, which is not the row id on most stacks; validation text lives in hidden template nodes, so only a **visible** error blocks paging; and a required group is unmet when *any* of its rows is empty — `requiredGroupsNeedingRows` names those groups, which is what the "next page" refusal was actually complaining about.
A fourth is not a lie but reads like one: a validation banner raised by a *blocked* page turn stays on screen after you fill the rows it complained about, so `audit.js` returns `PROBLEMS` while `blanks` and `requiredGroupsWithGaps` are both empty. Don't chase it — turn the page and re-audit.
Then check the sweep itself before believing it. `rows` is the denominator: if it is 0 while the page clearly has questions, `audit.js` returns `verdict: "SCOPE-EMPTY"` and a `scopeWarning` instead of `CLEAN`, because an audit that matched nothing would otherwise report "0 blanks, 0 problems" — the most convincing possible false pass. Widen the row selector per `references/widget-taxonomy.md` and re-run. Likewise an attention check whose column cannot be resolved without guessing returns `UNRESOLVED`, counted separately in `instructedUnresolved`; resolve it by hand rather than letting a blank verdict read as a pass.
`audit.js` also surfaces `payload.timing` — many instruments record a start timestamp and dwell time, so an implausibly fast completion is visible to the reviewer. Report it rather than hiding it.
**Keep big results out of context**: pass `filePath` to `evaluate_script` and probes/audits land on disk as JSON, returning only a one-line confirmation. Read back selectively.
### 7. Gate — before anything irreversible
Stop and get explicit confirmation for: submit/send/pay/publish, and any field that identifies or matches a person (phone, ID, email, employee number).
- **Never guess an identity field.** A wrong digit usually cannot be corrected after submit.
- **A value already present is not a value you confirmed.** Autofill or a user's manual typing must be read back and approved.
- Summarise what will be sent, then wait.
- The gate is enforced by code, not just by this paragraph: `nav.js` refuses `action: 'submit'` until `CONFIG.confirmText === 'SUBMIT-CONFIRMED'`. Setting that string *is* the act of taking the user's approval — do not set it to get past an error, and do not treat "just run it all" as covering it.
## Review Cadence — the default is per page, not per run
Automation is only acceptable while the user still controls it. Four rules that come from what users actually ask for after a bad run:
1. **One page per turn, then stop.** Fill the displayed page, emit its readback table, wait for the word. A whole-form sweep in one go looks faster but leaves him reviewing fifty Likert cells he cannot re-check individually — the review becomes theatre.
2. **"Just run it all, I'll check at the end" waives the per-page waits, never the submit gate.** The same phrase arriving twice means the first handover was not trusted yet; earn it with the readback format, not with a longer sweep.
3. **Evidence over assurance on check items.** "已核对" is not a result. Report scanned-versus-hit counts (`121 rows scanned, 3 instructed items found, 3 PASS`) and the five-layer chain per item: instruction text → required wording → column resolved by exact match → stored value → the cell the page actually lit. The coverage number is what lets him see the scan reached the hidden pages at all.
4. **Aggregate completeness, never spot-checked completeness.** `103/103 answered, one lit cell per row, zero visible validation errors` is a claim; "I checked three rows and they were fine" is not. Spot-checks are for *state survival* after a page turn, and they belong in a different sentence.
Anything whose origin is not you — browser autofill, someone else typing into the page, the form jumping pages by itself — is flagged with its source named, never adopted silently, even when the value looks correct.
The handover itself is a table he can check without opening DevTools: lead with the counts (`103/103 已答、0 空格、每行恰好一格高亮、无校验报错`), then the rows, then anything unverified.
```
| # | 题目 | 已选 | 判定 |
| 5 | ⚠️ 测试题:此题请选择"完全没有" | 完全没有 | ✅PASS |
```
## Cross-Field Consistency
Questionnaires score this, so it belongs in `verify`, not in luck: list reverse-worded items and check their direction against same-group positives, keep at least one or two differentiated cells per block (a uniform column is the classic invalid-response signature), and report residual risks you cannot control — a completion time far below the stated estimate, or two parallel blocks answered identically when the anchor fact says they should differ. Recipes: `references/question-types.md` → "Cross-field consistency rules".
## Replaying After State Loss
The answer key is the unit of recovery. Export it with `scripts/export_key.js` (pass `filePath` to land it on disk as JSON), then after a reload re-run probe — structure may differ — and replay page by page through `fill.js`. Do not re-derive answers from memory.
`export_key.js` emits `replayKey` in the one vocabulary `fill.js` understands — an exact option label, or a 1-based ordinal, never a raw stored value — plus `ambiguousRows` for rows that do not show exactly one lit cell. Fix those by hand before trusting a replay; a row with two lit cells is the invalid-response signature, not a formatting nuisance. The file also dumps `freeText`, which on a real survey means phone numbers and names: keep it on disk, never in a commit or a shared folder.
A **regenerated link** is a reload with extra steps. Fresh URLs (`?id=`, a new `/vm/xxxx.aspx`, a per-recipient token) are common on tracked surveys, and row ids can shift between rounds. Re-probe and re-map before replaying a saved key against one; keying by row id across two different structures writes the right answers into the wrong questions.
State loss also eats the *reason* you were filling, not just the ticks. If the anchors came from the user and are no longer in the record, ask again rather than reconstructing them — a recalled "you said you use AI sometimes" is how a real answer quietly becomes an invented one.
## After Every Run: Fold the Lesson Back In
This skill is only trustworthy while it is being updated. A job that went wrong in a way the
scripts did not predict is a defect in the skill, not an unlucky run — and the fix is not durable
until something re-tests it.
1. Record it in `references/iterations.md`: dated entry, platform + stack shape, symptom, root
cause, severity, and what was changed. One line is enough; a sentence the next agent can act
on is the requirement.
2. If a script was wrong, fix the script **and** add a case to `assets/fixture.html` (or a new
fixture) that fails without the fix. Every defect in the log has a fixture case beside it;
a fix with no case is a fix that silently regresses.
3. Re-run the regression table in `references/iterations.md` against the fixtures before
publishing. It is short enough to run in one sitting and specific enough — exact counts, exact
replayKey values, exact verdicts — that "it looked fine" does not pass it. The published repo
keeps the same steps as data in `evals/regression.json`; record the observed numbers there on the
same push, because a suite that is only described in prose drifts into fiction.
4. If the description changed, re-run `node evals/run_trigger.js` and compare with
`evals/baseline-trigger.json`. A wording edit that costs recall is not an improvement, and a
false trigger is only fixable by naming the sibling skill that owns that job.
5. If the skill is published, append a release-facing entry to the repo's `CHANGELOG.md` on the same
push: Added / Fixed / Changed / Verified, with the numbers the suite produced. The iteration log
is for the next agent; the changelog is for the next person deciding whether to upgrade.
Inferred stays inferred. `references/adapters.md` marks what has not been verified in a live run;
do not quietly promote a guess to a recipe because a job happened to work.
## Resources
Load scripts through the step-0 server rather than pasting bodies; each one is a self-contained
`() => {…}` you can also read before running.
- `scripts/serve.js` — localhost file server for the scripts dir (CORS + private-network preflight, `.js` allowlist, `no-store`). Start it first; everything else gets pasted in 4 lines.
- `scripts/probe.js` — widget/page/selection-marker/payload discovery, and the real-control visibility census that decides whether snapshots are usable at all. Run it before writing any selector.
- `scripts/scan_rules.js` — implicit instructions, click traps (`此题请选择"X"`) and type traps (`请输入"X"`), required groups, select caps, length and pattern constraints. Hidden pages included: `textContent`.
- `scripts/fill.js` — idempotent label/ordinal-driven filling, `dryRun`/`multi` modes, consent-box self-toggle, plus a `fields` channel for native controls (select resolved by option text, slider bounds-checked against its own min/max, date, textarea) that dispatches the events the page's handler needs and re-reads the hidden mirror; `input[type=file]` is refused by name and pointed at the tool that can do it. Edit its `CONFIG` block per task.
- `scripts/audit.js` — four-layer verification: blanks, multi-highlight, value-vs-marker, instructed PASS/FAIL/UNRESOLVED, visible validation errors, required-group gaps by name (attribute-marked groups *and* groups whose only marker is a native `required` control), native-field problems (empty-required, maxlength, pattern), payload audit, and a `SCOPE-EMPTY` guard so an unmatched sweep cannot read as a pass.
- `scripts/nav.js` — next/prev/submit/goto with post-transition survival spot-check, validation-block detection, and a hard interlock on `submit`.
- `scripts/export_key.js` — dumps the answer key (`rowId → label`/ordinal, page, title, ambiguous rows) for wipe-safe replay.
- `references/injection.md` — the loader in full: server call from `node_repl`, both CSP/mixed-content failure signatures, the trimmed-paste fallback, what each route costs.
- `references/widget-taxonomy.md` — how each stack exposes state; controlled-input, virtualised-list, iframe and shadow-DOM traps; the four evidence layers; value-vs-position encodings.
- `references/question-types.md` — per-answer-type fill/verify recipes, paging models, branching, attention-check variants beyond "此题请选择X", consistency rules.
- `references/adapters.md` — per-platform selector quick reference (问卷星 verified; others marked inferred — confirm with probe).
- `references/iterations.md` — the dated defect log and the regression table to run before every commit. Read it when a run surprises you, and append to it when it does.
- `assets/fixture.html` — hostile-but-supported survey page (letter-valued scales, doubled sticky header, non-answer anchor, icon-only options, native-only multi row, hidden page, type trap). The regression suite runs against it.
- `assets/fixture-cards.html` — card/React-style stack with no `tr[fid]`, used to prove the `SCOPE-EMPTY` guard and card-level instruction resolution.
Files in this package (15)
- SKILL.md 24 KB
- assets/fixture-cards.html 2 KB
- assets/fixture.html 10 KB
- references/adapters.md 3 KB
- references/injection.md 6 KB
- references/iterations.md 17 KB
- references/question-types.md 5 KB
- references/widget-taxonomy.md 7 KB
- scripts/audit.js 13 KB
- scripts/export_key.js 7 KB
- scripts/fill.js 13 KB
- scripts/nav.js 4 KB
- scripts/probe.js 9 KB
- scripts/scan_rules.js 12 KB
- scripts/serve.js 4 KB
Versions
The database has no other skills named web-form-driver.
Database snapshot: 13.11.2026 · package version 8ca84d4f99e5 (SHA-256 digest of the entire package)
Downloads in the last 30 days: 1 · ranking
Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.
Similar skills
- 90web-form-autofiller
When the user needs to fill out web forms with data from memory or structured sources, this skill automates the entire workflow reads form links from files, navigates to web forms, analyzes form structure and fields, extracts relevant data from memory or knowledge bases, maps… - 96web-form-filling
Use when filling SPA web forms through browser_exec.