Blog

Recorder, blocks, code or an AI agent: which browser automation should I use?

Published December 5, 2026 · Updated December 5, 2026 · Mirage Browser

Record the task once if it is short and always the same. Use blocks when it needs variables, waits and conditions. Move to code when it needs your data, retries and hundreds of runs. Use an AI agent when the task changes every time and can be described in words, and keep it under limits that a person approves.

What are the four options?

Approach Good for Breaks when
Recorder Short, identical steps The page layout changes or the steps branch
Blocks Variables, waits, conditions, a CSV of inputs Logic grows past a screen of steps
Code Data from your systems, retries, scale Nobody on the team can maintain it
AI agent Tasks that differ every time The task needs exact, repeatable results

They are not rivals. Most teams use two or three of them for different jobs.

Why do recorded scripts break?

A recorder writes down how it found each element. If it used a position or a long CSS path, a small redesign breaks it. Recorders that prefer a role and a visible name, such as “the button called Find”, survive much longer. Playwright’s own test generator works this way, and so do Mirage scenarios: a recorded click becomes a step that looks for a role and a name first.

When do blocks beat a recording?

When the same task runs with different inputs. A scenario with an order variable and a data table of order numbers runs once per row:

JSON
{ "type": "fill", "target": { "label": "Order number" }, "value": "{{order}}" }

Waits matter as much as clicks. A step that waits for a URL or an element is what keeps a flow from clicking before the page is ready.

When is it time for code?

When you need to read from a database, call your own API, retry with backoff or run on many machines. Moving should not mean starting over: a good tool exports the blocks as code. In Mirage Export writes the scenario as Playwright for TypeScript or Python, with the same element search and human-like input, so a developer continues where the blocks stopped.

Where does an AI agent fit?

Where the steps cannot be written in advance: “find the invoice for last month on each supplier’s site and download it”. An agent reads the page and decides. That flexibility is the risk too: a page can contain instructions aimed at the agent. Give it a separate profile, allowed domains and approval for payments and credentials, and read its journal.

Can I run any of these on a schedule?

Yes. A scenario can repeat every N minutes or on chosen weekdays while the app runs. For a server without a desktop, use the headless runner. Failures can go to a webhook or Telegram, so a broken flow does not fail silently for a week.

Start here: scenarios without code, automation SDK and AI agents.

Where do these facts come from?