New Tool Radar

AI Agents & Automation

How to Build a Browser Agent That Fills a Form with Verified Steps

Build a browser agent that fills a form one verified step at a time, so a wrong field is caught before the form is sent.

Schematic illustration with three step boxes: map the form fields, fill and verify each one, and submit only when all pass.

A browser agent that fills a form must verify each field as it goes: the value it typed is the value the field now holds. A successful click is not a successful entry, and a form that looks filled can hold a wrong value in one field. The verification loop classifies the screen state before and after every action, and only continues when the expected state is confirmed.

Before you start

A browser automation setup, such as Playwright, and a form you are allowed to test against.

Map the form fields first

List every field on the form with its name, its type, and the value it should get. Note the required fields and the format each one expects, such as a date in YYYY-MM-DD form.

Note the fields that change the form: a country choice that changes the postcode format, or a checkbox that reveals more fields.

Fill one field and verify it

Fill one field, then read the field back and compare it with the intended value before moving on. If the value differs, clear the field and try again, up to three times.

Verify the state, not the action: the check is that the field holds the right value, not that the type action returned without error.

Submit only when every field passes

Before submitting, read back every field once more and compare with the map. If any field fails, fix it before the submit, not after.

After submitting, verify the result page: a confirmation message, a reference number, or an error listing the fields that failed.

Practice check: fictional Maple Corner signup form, 6 fields

The table below is fictional practice material, worked out by hand from the stated form. It is the expected result for the practice form, not a run of any agent.

Field Intended value Field holds Verdict
Name Maple Corner Ltd Maple Corner Ltd Pass
Email [email protected] [email protected] Pass
Country United Kingdom United Kingdom Pass
Postcode SW1A 1AA SW1A 1AA Pass
Plan Standard Standard Pass
Terms Checked Checked Pass

All six fields hold their intended values when read back, so the form is submitted. The postcode and the plan were each verified after filling, not assumed.

Expected result. UNTESTED: the fields in the practice table are worked out by hand, not measured by running a browser agent. Map your own form’s fields, fill and verify each one by reading it back, and submit only when every field passes.

Limits

  • A successful click is not a successful entry: verify the field value, not the action.
  • Test against a form you are allowed to use: never submit a real form with test data.

Sources

See all