# AutoFiller Universal
**Batch-fill any web form from a spreadsheet — deterministically, with no LLM in the loop at the moment that matters.**
[](https://www.python.org/)
[](LICENSE)
[](#testing)
[](https://playwright.dev/)
Point it at an Excel/CSV/JSON file and a form. Everything specific to a given
form lives in **one JSON file** — the *recipe*. The engine, the launcher and the
safety guards never change.
---
## The problem
Public-administration portals often run **click-days**: a funding window opens at
09:00:00 and closes when the budget is exhausted, sometimes minutes later. Behind
the SPID login there are hundreds of near-identical records to type into a modal
form — name, surname, date of birth, tax code, cascading province/municipality
selects — one at a time, by hand, under time pressure.
Three things go wrong:
1. **Speed.** Manual typing costs ~40 seconds per record. 150 records is 100 minutes.
2. **Accuracy.** One mistyped tax code and the record is rejected — sometimes the
whole application.
3. **Fragility.** Naive automation breaks the moment the portal ships a new build
and every `id` changes, and it breaks *silently*.
Generic RPA tools want to own the browser session. That does not work when the
session sits behind an interactive SPID/CIE login and ends in a legally binding
submission. AutoFiller takes the opposite approach: **you** own the browser and
the final click; it only types.
---
## How it works
Two phases, with a hard rule between them: **the LLM is used offline, never at
click-day.** Phase 2 is pure deterministic DOM work — no network calls, no model
latency, no non-determinism.
```
┌──────────────────────────── PHASE 1 — offline, once per form ────┐
DATA │ │
.xlsx │ recipe_maker.py │
.csv ──┼──▶ reads the live DOM over CDP │
.json │ ├─ (default) LLM maps headers → selectors │
│ ├─ --auto zero-LLM semantic matching (label/name/synonyms) │
│ └─ --pick point & click panel in the browser │
│ │ │
│ ▼ │
│ recipe.json + field fingerprints + form.snapshot.html │
└───────────┬──────────────────────────────────────────────────────┘
│
┌───────────▼──────────── validation, still offline ───────────────┐
│ rehearsal.py replays ALL records against the HTML snapshot │
│ check_data.py tax-code checksums, dates, duplicates, and every │
│ value matched against the REAL select options │
└───────────┬──────────────────────────────────────────────────────┘
│
┌───────────▼──────────── PHASE 2 — click-day, N records ──────────┐
│ launcher.py attaches to YOUR Chrome (CDP :9222, already │
│ logged in via SPID) and injects engine.js │
│ │
│ for each record: add ▸ fillWith(record, recipe) ▸ save │
│ ZERO LLM · dialog guard · run log · resume │
│ STOPS before confirm / sign / submit │
└───────────────────────────────────────────────────────────────────┘
```
```mermaid
flowchart LR
D[("Excel / CSV / JSON")] --> RM[recipe_maker.py LLM · --auto · --pick]
DOM[("Live DOM via CDP")] --> RM
RM --> R[["recipe.json + fingerprints"]]
RM --> S[["form.snapshot.html"]]
R --> CD[check_data.py pre-flight]
S --> RH[rehearsal.py offline dry run]
D --> CD
D --> RH
R --> L[launcher.py]
L -->|injects| E[[engine.js ~1000 LOC, no LLM]]
E --> C(("Your Chrome SPID session"))
L -.->|never clicks| X{{confirm · sign · submit}}
```
* **`engine.js`** — one engine for every form. Injected once, then
`window.__AUTOFILL__.fillWith(record, recipe)` per record. Handles text,
native `