With expect.textNew, I'd still check that the new confirmation belongs to the action just taken. A toast from another request is new too. For the booking example, a reference plus the submitted date would be stronger evidence than a fresh 'Success' message.
Full-stack developer in Vietnam. I build browser automation and MCP tools for AI agents (turbo-browser-mcp) and Postgres RLS checks for Supabase (supabase-rls-check).
Location
Vietnam (UTC+7)
Education
IT student, Industrial University of Ho Chi Minh City (IUH)
Good point. Right now expect lets you combine textNew with urlMatches and selector, so passing the chosen date or slot text instead of a generic "Success" string is the safer pattern when background toasts can fire.
Web search, Extract (page to markdown) and Render for AI agents. Pay per call in USDC via native x402 on Base. No account, no API key. Also on Pocket Network.
The submit guard section is the part I'd steal. A verb list will keep missing cases (localized labels, icon-only buttons), so have you tried also checking what the click would actually do, like whether the button sits inside a form with a POST action, or whether it fires a non-GET request? Treating "unknown final step" as blocked by default and letting the agent ask seems safer than growing the list forever. And +1 on reading the value back after blur. Date pickers fool almost every fill tool I've seen.
Full-stack developer in Vietnam. I build browser automation and MCP tools for AI agents (turbo-browser-mcp) and Postgres RLS checks for Supabase (supabase-rls-check).
Location
Vietnam (UTC+7)
Education
IT student, Industrial University of Ho Chi Minh City (IUH)
The guard checks more than the label. A type=submit button or any button inside a form counts as a submit, and a safe label like Search lets it through. Icon-only buttons outside a form do slip past, you're right there. Watching for a non-GET request after the click would make a good second check, I'll try it.
Web search, Extract (page to markdown) and Render for AI agents. Pay per call in USDC via native x402 on Base. No account, no API key. Also on Pocket Network.
Makes sense, type=submit plus form membership covers the common cases. The non-GET watch is a nice backstop because it catches the side effect itself, whatever the button looks like, including JS handlers that fire a fetch on click. Curious how it goes.
The date field story is the one I will remember. A fill that reports success and then quietly loses the value on blur is worse than a fill that fails loudly, because everything downstream trusts it. Reading the value back after blur is a simple check, and it is the kind of check that belongs in every form flow, not only in agent tooling. The submit guard lesson lands the same way: a guard that only watches labels will miss real submissions and block harmless clicks, so checking the form and the button type makes a lot more sense.
Full-stack developer in Vietnam. I build browser automation and MCP tools for AI agents (turbo-browser-mcp) and Postgres RLS checks for Supabase (supabase-rls-check).
Location
Vietnam (UTC+7)
Education
IT student, Industrial University of Ho Chi Minh City (IUH)
Same feeling here. The silent success was worse than any crash, because the agent went on and submitted the form. Reading the value back also caught a second case later: fields with maxlength or an input mask that cut the typed text. Those now come back with a mismatch note instead of a plain ok.
We check MCP servers and websites from the outside, the way an AI agent sees them, and publish what we find with names and dates. Free tools at x1y1.co/tools.
The authwall label is a good addition. I'd add a separate one for bot walls, because they look like empty pages too. When we ran our agent-readiness checker on the 50 state election sites plus DC, 10 sent a bot-protection response, and a few served a near-empty noindex page instead. Virginia gave our checker 1 word and a normal browser 482. An agent that reads that as "the page is empty" draws the wrong conclusion. Flagging a 403/429 from a bot-protection layer, a Cloudflare "Just a moment..." title or a tiny noindex body as blocked: "challenge" would tell it to stop instead of guessing.
Full-stack developer in Vietnam. I build browser automation and MCP tools for AI agents (turbo-browser-mcp) and Postgres RLS checks for Supabase (supabase-rls-check).
Location
Vietnam (UTC+7)
Education
IT student, Industrial University of Ho Chi Minh City (IUH)
Part of this is in already: a "Just a moment..." title or a verify-you're-human body comes back as blocked: cloudflare, bot-wall or captcha. The near-empty noindex page isn't covered yet. Your Virginia numbers (1 word vs 482) are a good test case, I'll add it.
The one that got me from the same kind of overnight run: stale uids. I'd take a snapshot, the page's own JS re-rendered, and the uid I was about to click pointed at a different element entirely. The click "succeeded". Now I re-snapshot immediately before every act and treat any uid older than one navigation as invalid. Related trap: a page returning HTTP 200 told me nothing about whether the thing I cared about actually rendered. Your per-tab timeout with unresponsive: true is a good shape. I run a paid audit endpoint that catches this class of MCP/browser flakiness, disclosure that it's mine, but the re-snapshot rule costs nothing.
Full-stack developer in Vietnam. I build browser automation and MCP tools for AI agents (turbo-browser-mcp) and Postgres RLS checks for Supabase (supabase-rls-check).
Location
Vietnam (UTC+7)
Education
IT student, Industrial University of Ho Chi Minh City (IUH)
turbo covers that one by never reusing a ref inside a document. New refs start above the highest one already handed out, so a stale ref fails with a hint and can't land on a different element. The 200-but-nothing-rendered case is why act can wait for the text it expects to show up.
The CDP session-mixing failure is a great concrete warning: a shared upstream connection only works if the bridge really isolates per-client sessions and contexts, otherwise one silent client can stall every evaluate waiting on a context event it never receives. The per-tab timeout is the other half of that same lesson; without a bounded setup probe, one paused frame becomes a global blocker for the whole batch. This maps directly onto Electron multi-window automation: each WebContents should get its own detached session and a hard probe timeout before any scripted action, and an unresponsive renderer should be reported as such rather than allowed to hang the orchestrator.
Full-stack developer in Vietnam. I build browser automation and MCP tools for AI agents (turbo-browser-mcp) and Postgres RLS checks for Supabase (supabase-rls-check).
Location
Vietnam (UTC+7)
Education
IT student, Industrial University of Ho Chi Minh City (IUH)
Agreed. The per-tab timeout was the cheaper half to add, and it turned a silent hang into an error the agent could act on. I haven't automated Electron, but one session per WebContents sounds like the same rule.
Unattended runs need their cap inside the run: a turn limit first, and a budget per job on top. A morning review of the bill arrives after the money is gone. Does your run have a turn limit?
Full-stack developer in Vietnam. I build browser automation and MCP tools for AI agents (turbo-browser-mcp) and Postgres RLS checks for Supabase (supabase-rls-check).
Location
Vietnam (UTC+7)
Education
IT student, Industrial University of Ho Chi Minh City (IUH)
No hard cap in that run. It was a Claude Code loop on a subscription, one pass every 30 minutes, so the risk was burning quota rather than a bill showing up later. You're right that the limit belongs inside each pass though. A --max-turns per pass is cheap to add and I'll set it before the next overnight run.
Building icon and graphics tools for developers since 1990. Makers of IconVectors, IconWorkshop & IconGenerator. Sharing practical SVG tips, icon workflows, and AI-assisted editing.
Full-stack developer in Vietnam. I build browser automation and MCP tools for AI agents (turbo-browser-mcp) and Postgres RLS checks for Supabase (supabase-rls-check).
Location
Vietnam (UTC+7)
Education
IT student, Industrial University of Ho Chi Minh City (IUH)
Before the step runs, textNew records every visible DOM element already holding that text in a WeakSet. If the second export mounts a new toast node, !seen.has(el) catches it. If the app reuses the same visible status element in place, seen.has(el) skips it, so you have to wait for textGone (or "Exporting...") first.
Building icon and graphics tools for developers since 1990. Makers of IconVectors, IconWorkshop & IconGenerator. Sharing practical SVG tips, icon workflows, and AI-assisted editing.
With
expect.textNew, I'd still check that the new confirmation belongs to the action just taken. A toast from another request is new too. For the booking example, a reference plus the submitted date would be stronger evidence than a fresh 'Success' message.Good point. Right now
expectlets you combinetextNewwithurlMatchesandselector, so passing the chosen date or slot text instead of a generic "Success" string is the safer pattern when background toasts can fire.The submit guard section is the part I'd steal. A verb list will keep missing cases (localized labels, icon-only buttons), so have you tried also checking what the click would actually do, like whether the button sits inside a form with a POST action, or whether it fires a non-GET request? Treating "unknown final step" as blocked by default and letting the agent ask seems safer than growing the list forever. And +1 on reading the value back after blur. Date pickers fool almost every fill tool I've seen.
The guard checks more than the label. A type=submit button or any button inside a form counts as a submit, and a safe label like Search lets it through. Icon-only buttons outside a form do slip past, you're right there. Watching for a non-GET request after the click would make a good second check, I'll try it.
Makes sense, type=submit plus form membership covers the common cases. The non-GET watch is a nice backstop because it catches the side effect itself, whatever the button looks like, including JS handlers that fire a fetch on click. Curious how it goes.
The date field story is the one I will remember. A fill that reports success and then quietly loses the value on blur is worse than a fill that fails loudly, because everything downstream trusts it. Reading the value back after blur is a simple check, and it is the kind of check that belongs in every form flow, not only in agent tooling. The submit guard lesson lands the same way: a guard that only watches labels will miss real submissions and block harmless clicks, so checking the form and the button type makes a lot more sense.
Same feeling here. The silent success was worse than any crash, because the agent went on and submitted the form. Reading the value back also caught a second case later: fields with maxlength or an input mask that cut the typed text. Those now come back with a mismatch note instead of a plain ok.
The authwall label is a good addition. I'd add a separate one for bot walls, because they look like empty pages too. When we ran our agent-readiness checker on the 50 state election sites plus DC, 10 sent a bot-protection response, and a few served a near-empty noindex page instead. Virginia gave our checker 1 word and a normal browser 482. An agent that reads that as "the page is empty" draws the wrong conclusion. Flagging a 403/429 from a bot-protection layer, a Cloudflare "Just a moment..." title or a tiny noindex body as blocked: "challenge" would tell it to stop instead of guessing.
Part of this is in already: a "Just a moment..." title or a verify-you're-human body comes back as blocked: cloudflare, bot-wall or captcha. The near-empty noindex page isn't covered yet. Your Virginia numbers (1 word vs 482) are a good test case, I'll add it.
The one that got me from the same kind of overnight run: stale uids. I'd take a snapshot, the page's own JS re-rendered, and the uid I was about to click pointed at a different element entirely. The click "succeeded". Now I re-snapshot immediately before every act and treat any uid older than one navigation as invalid. Related trap: a page returning HTTP 200 told me nothing about whether the thing I cared about actually rendered. Your per-tab timeout with unresponsive: true is a good shape. I run a paid audit endpoint that catches this class of MCP/browser flakiness, disclosure that it's mine, but the re-snapshot rule costs nothing.
turbo covers that one by never reusing a ref inside a document. New refs start above the highest one already handed out, so a stale ref fails with a hint and can't land on a different element. The 200-but-nothing-rendered case is why act can wait for the text it expects to show up.
The CDP session-mixing failure is a great concrete warning: a shared upstream connection only works if the bridge really isolates per-client sessions and contexts, otherwise one silent client can stall every evaluate waiting on a context event it never receives. The per-tab timeout is the other half of that same lesson; without a bounded setup probe, one paused frame becomes a global blocker for the whole batch. This maps directly onto Electron multi-window automation: each WebContents should get its own detached session and a hard probe timeout before any scripted action, and an unresponsive renderer should be reported as such rather than allowed to hang the orchestrator.
Agreed. The per-tab timeout was the cheaper half to add, and it turned a silent hang into an error the agent could act on. I haven't automated Electron, but one session per WebContents sounds like the same rule.
Unattended runs need their cap inside the run: a turn limit first, and a budget per job on top. A morning review of the bill arrives after the money is gone. Does your run have a turn limit?
No hard cap in that run. It was a Claude Code loop on a subscription, one pass every 30 minutes, so the risk was burning quota rather than a bill showing up later. You're right that the limit belongs inside each pass though. A --max-turns per pass is cheap to add and I'll set it before the next overnight run.
@tthanh2k6 Agreed, the cap that matters is the one inside each pass. A monthly limit only tells you the damage after the pass already ran.
For repeated exports, how does textNew distinguish a fresh “Export complete” message from the previous one?
Before the step runs,
textNewrecords every visible DOM element already holding that text in aWeakSet. If the second export mounts a new toast node,!seen.has(el)catches it. If the app reuses the same visible status element in place,seen.has(el)skips it, so you have to wait fortextGone(or"Exporting...") first.Thanks, that clears it up. I hadn’t thought about the two exports sharing the same status line.