turbo-browser-mcp 0.0.0-stage → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +436 -2
- package/benchmarks/E2E_COMPARISON.md +57 -0
- package/benchmarks/E2E_PLAN.md +131 -0
- package/benchmarks/benchmark.mjs +773 -0
- package/benchmarks/e2e-agent/.gitattributes +2 -0
- package/benchmarks/e2e-agent/README.md +128 -0
- package/benchmarks/e2e-agent/evaluate.mjs +35 -0
- package/benchmarks/e2e-agent/fixtures/attachment.pdf +22 -0
- package/benchmarks/e2e-agent/fixtures/attachment.pdf.sha256 +1 -0
- package/benchmarks/e2e-agent/install-stacks.ps1 +30 -0
- package/benchmarks/e2e-agent/report.mjs +16 -0
- package/benchmarks/e2e-agent/run.ps1 +10 -0
- package/benchmarks/e2e-agent/runner.mjs +139 -0
- package/benchmarks/e2e-agent/self-test.mjs +73 -0
- package/benchmarks/e2e-agent/server.mjs +96 -0
- package/benchmarks/e2e-agent/stacks/agent-browser.md +3 -0
- package/benchmarks/e2e-agent/stacks/browse.md +3 -0
- package/benchmarks/e2e-agent/stacks/browser-harness.md +3 -0
- package/benchmarks/e2e-agent/stacks/turbo.md +2 -0
- package/benchmarks/e2e-agent/uninstall-stacks.ps1 +11 -0
- package/benchmarks/e2e-tasks.mjs +258 -0
- package/package.json +41 -4
- package/server.json +20 -0
- package/src/aftermath.mjs +42 -0
- package/src/browser-manager.mjs +1418 -0
- package/src/cdp-bridge.mjs +637 -0
- package/src/dom-engine.mjs +6541 -0
- package/src/guards.mjs +294 -0
- package/src/index.mjs +1207 -0
- package/src/playwright-loader.mjs +320 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Trung Thanh Tran
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,437 @@
|
|
|
1
|
-
#
|
|
1
|
+
# turbo-browser-mcp
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[](https://github.com/Tthanh2k6/turbo-browser-mcp/actions/workflows/ci.yml)
|
|
4
|
+

|
|
5
|
+
-brightgreen)
|
|
6
|
+

|
|
7
|
+

|
|
8
|
+
|
|
9
|
+
`turbo-browser-mcp` is a Playwright-based Model Context Protocol (MCP) server built to cut LLM token waste and multi-turn latency in browser automation. It consolidates 25-33 fine-grained browser primitives into **10 batched tools** featuring delta DOM snapshots, single-turn React/Shadow DOM/iframe form prefill, direct disk file uploads (no Base64 in context), parallel tab sessions, network blocking presets, and a default human-in-the-loop Submit guard.
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## At-a-Glance Performance & Token Scorecard
|
|
14
|
+
|
|
15
|
+
All figures below come from [`benchmarks/benchmark.mjs`](benchmarks/benchmark.mjs) (`npm run benchmark`) running headless Chromium locally with exact OpenAI `o200k_base` tokenization (`tiktoken 0.14.0`):
|
|
16
|
+
|
|
17
|
+
| Capability | Typical Baseline | `turbo-browser-mcp` | Speed / Turn Gain | Token Savings (`o200k_base`) |
|
|
18
|
+
| :--- | :--- | :--- | :--- | :--- |
|
|
19
|
+
| **Dense UI Snapshot** (140-btn SaaS console) | `18,654` tok HTML / `3,568` tok full ARIA | **`1,135` tok** compact (`28 ms`) | `1` call | **`93.9%` vs HTML** (`68.2%` vs ARIA) |
|
|
20
|
+
| **Post-Click Delta Snapshot** (`onlyChanged: true`) | `3,582` tok full ARIA rescan | **`56` tok** changed lines (`18 ms`) | `1` call | **`98.4%` vs ARIA** (`99.7%` vs HTML) |
|
|
21
|
+
| **10-Field Complex Form + Snapshot** (`smart_fill_form`) | `11` turns (`574 ms`, `12,197` dir / `72,614` cum tok) | **`1` turn** (`82 ms`, **`811` tok**) | **`7x` faster**, `11 -> 1` turns | **`93.4%` direct / `98.9%` cumulative** |
|
|
22
|
+
| **48 KiB PDF Upload** (`49,152` bytes) | `44,728` tok inline Base64 tool arg | **`85` tok** disk path (`68 ms`) | Zero Base64 generation | **`99.8%` saved** |
|
|
23
|
+
| **6-Step Interactive UI Flow** (`batch_actions`) | `6` turns (`411 ms`, `955` dir / `3,162` cum tok) | **`1` turn** (`357 ms`, **`406` tok**) | **`1.15x` faster**, `6 -> 1` turns | **`57.5%` direct / `87.2%` cumulative** |
|
|
24
|
+
| **Open 6 Tabs Concurrently** (`open_many`) | `6` turns sequential (`998 ms`) | **`1` turn** batched (`420 ms`) | **`2.38x` faster**, `6x` fewer turns | `5` fewer prompt replays |
|
|
25
|
+
| **Heavy Media Load** (`preset: "turbo"`, `304 KiB` assets) | `252 ms`, `9` media requests (`304 KiB`) | **`165 ms`**, `0` media requests (`0 KiB`) | **`1.53x` faster** | **`100%` media bandwidth cut** |
|
|
26
|
+
| **Article Markdown Scraping** (`extract_clean_text`) | `3,595` tok raw HTML (`10,844` chars) | **`156` tok** clean Markdown (`641` chars) | Clean reader output | **`95.7%` saved** |
|
|
27
|
+
| **Diagnostics Triage** (`page_diagnostics` errors-only) | `3,460` tok unfiltered (`32` req / `26` console) | **`601` tok** default errors (`2` req / `6` console) | Zero noise scrolling | **`82.6%` saved** |
|
|
28
|
+
| **Static MCP Tool Schema** (every turn overhead) | `3,917` tok Playwright / `6,737` tok DevTools | **`3,170` tok** stripped (`3,541` full w/ annotations) | `11` tools vs `25` / `33` | **`19.1%` vs Playwright / `52.9%` vs DevTools** |
|
|
29
|
+
|
|
30
|
+
> **Note on latency vs LLM inference turns:** Eliminating `10` round-trips on a 10-field form saves both `7x` in browser execution (`574 ms -> 82 ms`) and `10` separate LLM inference round-trips (`2-5s` per turn in agent loops) plus `~71,800` replayed history tokens.
|
|
31
|
+
|
|
32
|
+
---
|
|
33
|
+
|
|
34
|
+
## Why Browser Agents Stall: Side-by-Side Workflow
|
|
35
|
+
|
|
36
|
+
Standard MCP servers charge an LLM round-trip for every snapshot, field fill, `<select>` choice, upload, and verification check. Each turn re-sends the growing conversation history back into the model.
|
|
37
|
+
|
|
38
|
+
```mermaid
|
|
39
|
+
sequenceDiagram
|
|
40
|
+
autonumber
|
|
41
|
+
participant Agent as LLM Agent
|
|
42
|
+
participant Std as Standard MCP (Playwright / DevTools)
|
|
43
|
+
participant Turbo as turbo-browser-mcp
|
|
44
|
+
|
|
45
|
+
Note over Agent,Std: Standard MCP (12+ LLM turns, full ARIA tree + history replay each step)
|
|
46
|
+
Agent->>Std: 1. snapshot() -> full ARIA (~3,568 tok)
|
|
47
|
+
loop Repeats 10+ times across fields, selects, checkboxes, upload
|
|
48
|
+
Agent->>Std: fill / select_option / click
|
|
49
|
+
Std-->>Agent: full ARIA or confirmation re-added to history
|
|
50
|
+
end
|
|
51
|
+
Agent->>Std: 12. upload inline or click chooser
|
|
52
|
+
|
|
53
|
+
Note over Agent,Turbo: turbo-browser-mcp (2 LLM turns total, delta & inline snapshot)
|
|
54
|
+
Agent->>Turbo: 1. inspect_compact(mode: "forms") -> compact refs (1,135 tok)
|
|
55
|
+
Agent->>Turbo: 2. smart_fill_form(fields: [...10 fields + disk PDF...], returnSnapshot: true)
|
|
56
|
+
Turbo-->>Agent: Filled 10 fields + guarded before Submit + inline snapshot (811 tok)
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
---
|
|
60
|
+
|
|
61
|
+
## What `turbo-browser-mcp` Supports
|
|
62
|
+
|
|
63
|
+
### 1. Connection & Session Isolation
|
|
64
|
+
- **4 connection modes (`--mode auto|cdp|persistent|launch`):**
|
|
65
|
+
- `auto` (default): probes `--cdp http://127.0.0.1:9222` first so agents can reuse an existing signed-in browser session, then falls back to launching Chromium.
|
|
66
|
+
- `cdp`: attach directly to a running Chromium/Chrome/Edge remote debugging port.
|
|
67
|
+
- `persistent`: launch with a reusable `--user-data-dir` profile across runs.
|
|
68
|
+
- `launch`: start a clean browser session (`--headless` by default, or `--headed`).
|
|
69
|
+
- **Auto binary discovery (`src/playwright-loader.mjs`):** checks `playwright-core` cache revisions across Windows, macOS, and Linux, system installs of Google Chrome, Microsoft Edge, Brave, and Chromium, or an explicit `--executable <path>`.
|
|
70
|
+
- **Per-tab isolation (`tabs_batch`):** open tabs inside named `isolatedContext` sandboxes with separate cookies and storage, batch-open up to 10 concurrent URLs (`open_many`), activate, reload, go `back`/`forward`, `resize` viewport, and emulate `colorScheme`, `media`, `reducedMotion`, `contrast`, `forcedColors`, or custom `userAgent`.
|
|
71
|
+
|
|
72
|
+
### 2. DOM, Iframe & Shadow DOM Inspection (`inspect_compact`)
|
|
73
|
+
- **Snapshot modes:** `interactive`, `forms`, `article`, and `all`.
|
|
74
|
+
- **Cross-boundary traversal:** flattens main frame DOM, child iframes (`includeFrames`, `frameIdx`), and open Shadow DOM. Injects an init script hooking `Element.prototype.attachShadow` (`WeakMap` + `WeakRef`/`FinalizationRegistry` + `window.__tbmGetShadowRoot`) to keep post-init closed Shadow roots inspectable and guarded, traverses `<slot>` `assignedNodes({ flatten: true })`, and supports Form-Associated Custom Elements.
|
|
75
|
+
- **Token controls:** `onlyChanged: true` emits only elements added or changed since the prior snapshot; `query` filters by regex or substring; `boxes: true` adds `[box=x,y,w,h]` only when needed; `maxChars` caps payload size; `savePath` writes full output to disk.
|
|
76
|
+
|
|
77
|
+
### 3. Single-Turn Smart Form Engine (`smart_fill_form`)
|
|
78
|
+
Prefills an entire form in one MCP call while flushing microtasks and macrotasks between controlled inputs:
|
|
79
|
+
- **Standard & framework inputs:** text, email, password, number, date, textarea, `<input type="range">`, checkboxes, radio groups (`check`, `not`, `overwrite`). Triggers React-controlled state updates via native property setters and synthetic events.
|
|
80
|
+
- **Selects & custom widgets:** `<select>` and `<select multiple>` (`option` / `values`), ARIA comboboxes, ARIA switches, `contenteditable` rich editors, and Gmail compose dialogs (`gmail: { to, subject, body }`).
|
|
81
|
+
- **Frame & wildcard targeting:** target specific iframes via `frameIdx`, or set `all: true` to populate matching controls across frames.
|
|
82
|
+
- **Direct disk uploads:** pass `file` or `files` paths directly to Playwright `setInputFiles` without loading binary files or Base64 strings into LLM context.
|
|
83
|
+
- **Atomic verification:** pass `returnSnapshot: true` to inspect the updated form state in the same tool response.
|
|
84
|
+
|
|
85
|
+
### 4. 16 Interactive Actions & Multi-Step Chaining (`act_fast`, `batch_actions`)
|
|
86
|
+
- **`act_fast` actions:** `click`, `dblclick`, `hover`, `focus`, `clear`, `fill`, `type` (`slowly`, `delayMs`, `submit`), `select`, `check`, `uncheck`, `drag`, `drop` (`file`, `files`, or custom MIME `dropData`), `press` (`key` + `modifiers`: `Alt`, `Control`, `ControlOrMeta`, `Meta`, `Shift`), `scroll` (`dx`, `dy`), `wait` (`ms`, `state`, `loadState`, `text`, `textGone`, `url`), and `upload`.
|
|
87
|
+
- **Targeting options:** compact `[eN]` `ref`, CSS `selector`, visible `text`, `label`, or viewport `(x, y)` coordinates, with `button` (`left`, `right`, `middle`) and `frameIdx`.
|
|
88
|
+
- **`batch_actions`:** runs an ordered list of DOM actions and nested `smart_fill_form` steps in one MCP call, stopping safely if blocked by the Submit guard or optionally continuing on step errors (`continueOnError`).
|
|
89
|
+
|
|
90
|
+
### 5. Clean Extraction, Evaluation & Media Capture (`extract_clean_text`, `evaluate_js`, `capture_page`)
|
|
91
|
+
- **`extract_clean_text`:** extracts readable plain text or compact Markdown (`format: "text" | "markdown"`) from main/article containers and iframes, stripped of script and style noise.
|
|
92
|
+
- **`evaluate_js`:** runs JS expressions or `(el, arg)` element functions in any frame (`frameIdx`) with JSON-serialized results and optional `savePath` export.
|
|
93
|
+
- **`capture_page`:** full-page or element-scoped screenshots (`png` or `jpeg` with `quality`, `css` or `device` scale, optional `returnImage`) and PDF generation saved to a confined `savePath`.
|
|
94
|
+
|
|
95
|
+
### 6. Network Blocking, Storage State & Diagnostics (`network_session`, `page_diagnostics`)
|
|
96
|
+
- **`network_session` presets:** `turbo`, `no-images`, `no-media`, and `clean` (unblock all), alongside custom `blockResources` and `blockUrls` patterns.
|
|
97
|
+
- **Session & storage management:** read/write/clear browser `cookies`, `localStorage`/`sessionStorage`, and export or reload full Playwright `storageState` JSON files (`saveStorageStatePath`, `loadStorageStatePath`).
|
|
98
|
+
- **`page_diagnostics`:** defaults to errors-only (`level: "errors"`, `statusFilter: "errors"`) to surface failures cleanly without flooding context, while supporting `all`, `includeStatic`, `urlFilter`, deep request/response inspection (`reqId` + `part`), completed downloads, and dialog auto-handling (`dialogPolicy`: `accept`/`dismiss`).
|
|
99
|
+
|
|
100
|
+
---
|
|
101
|
+
|
|
102
|
+
## Reproducible Benchmarks (`npm run benchmark`)
|
|
103
|
+
|
|
104
|
+
Run the benchmark suite yourself with Chromium and Playwright installed:
|
|
105
|
+
|
|
106
|
+
```bash
|
|
107
|
+
npm run benchmark
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
**Environment & methodology:** Headless Chromium via `playwright-core`, counting exact OpenAI `o200k_base` tokens via Python `tiktoken` (`approx-bpe` fallback if `tiktoken` is unavailable). Cumulative workflow tokens model standard chat-history replay across $N$ sequential turns: $\sum_{i=1}^{N} (N - i + 1) \cdot T_i$, plus a one-shot baseline where the first turn captures context before acting.
|
|
111
|
+
|
|
112
|
+
### 1. Snapshot & Reader Extraction (Chars & Exact `o200k_base` Tokens)
|
|
113
|
+
|
|
114
|
+
| Scenario | Raw HTML | Full Playwright ARIA | `turbo-browser-mcp` Output | Saved vs ARIA | Saved vs HTML |
|
|
115
|
+
| :--- | :--- | :--- | :--- | :--- | :--- |
|
|
116
|
+
| **140-Button SaaS Console** (`inspect_compact`) | `61,010` chars (`18,654` tok) | `12,771` chars (`3,568` tok) | **`3,968` chars (`1,135` tok)** | **`68.2%`** | **`93.9%`** |
|
|
117
|
+
| **Post-Click Delta** (`onlyChanged: true`) | `61,010` chars (`18,654` tok) | `12,825` chars (`3,582` tok) | **`168` chars (`56` tok)** | **`98.4%`** | **`99.7%`** |
|
|
118
|
+
| **Article Markdown Extraction** (`extract_clean_text`) | `10,844` chars (`3,595` tok) | n/a | **`641` chars (`156` tok)** | n/a | **`95.7%`** |
|
|
119
|
+
| **Diagnostics Filter** (`32` reqs, `26` console logs) | `9,651` chars (`3,460` tok, `all`) | n/a | **`1,761` chars (`601` tok, `errors`)** | n/a | **`82.6%`** |
|
|
120
|
+
|
|
121
|
+
### 2. Multi-Turn Forms, Workflows, Uploads & Network Speed
|
|
122
|
+
|
|
123
|
+
| Scenario | Step-by-Step Baseline | `turbo-browser-mcp` | Execution Speedup | Token Savings |
|
|
124
|
+
| :--- | :--- | :--- | :--- | :--- |
|
|
125
|
+
| **10-Field Complex Form + Verify** (`smart_fill_form`) | `11` turns, `574 ms`, `12,197` direct / `72,614` cum tok | **`1` turn**, **`82 ms`**, **`811` tok** (`filled=10`) | **`7x` faster** | **`93.4%` dir / `98.9%` cum** |
|
|
126
|
+
| **48 KiB PDF Upload** (`49,152` bytes via `file`) | `65,679` chars (`44,728` tok) Base64 payload | **`263` chars (`85` tok)** disk path (`68 ms`) | Zero LLM Base64 encode | **`99.8%`** |
|
|
127
|
+
| **6-Step UI Flow** (`batch_actions`) | `6` turns, `411 ms`, `955` dir / `3,162` cum tok | **`1` turn**, **`357 ms`**, **`406` tok** | **`1.15x` faster** | **`57.5%` dir / `87.2%` cum** |
|
|
128
|
+
| **Open 6 Tabs** (`tabs_batch` `open_many`, `60 ms` TTFB) | `6` turns sequential (`998 ms`) | **`1` turn** batched (`420 ms`) | **`2.38x` faster** (`6 -> 1` turns) | Eliminates `5` turns |
|
|
129
|
+
| **Heavy Media Load** (`8x32 KiB` imgs + `48 KiB` font) | `252 ms`, `9` media hits (`304 KiB`) | **`165 ms`**, `0` media hits (`0 KiB`) | **`1.53x` faster** | **`100%` media saved** |
|
|
130
|
+
|
|
131
|
+
### 3. Static MCP Tool Definition Footprint
|
|
132
|
+
|
|
133
|
+
Measured against installed MCP JSON schemas on disk (compact parameter schemas without `annotations`):
|
|
134
|
+
|
|
135
|
+
| MCP Server | Tool Count | Compact Schema Chars | Exact `o200k_base` Tokens | Savings with `turbo-browser-mcp` |
|
|
136
|
+
| :--- | :--- | :--- | :--- | :--- |
|
|
137
|
+
| `turbo-browser-mcp` | **`11`** (`15,144` full / `13,631` compact) | **`13,631`** | **`3,170`** (`3,541` full w/ annotations) | Baseline (`11` tools) |
|
|
138
|
+
| `@playwright/mcp` | `25` | `18,457` | `3,917` | **`19.1%` fewer static tokens** |
|
|
139
|
+
| `chrome-devtools-mcp` | `33` | `30,252` | `6,737` | **`52.9%` fewer static tokens** |
|
|
140
|
+
|
|
141
|
+
v0.5.0 added `wait_for_human` and the commit-safety parameters for about 160 tokens per turn (v0.4.0: `3,010` compact). To keep that small, `expect` / `submissionKey` / `allowDuplicate` are declared only on `batch_actions` (a one-step batch works for a single click), and the network guard is switched on by environment variable, so it costs no schema tokens. The label lists for other languages run inside the page and are never sent to the model.
|
|
142
|
+
|
|
143
|
+
---
|
|
144
|
+
|
|
145
|
+
## Comparison vs `@playwright/mcp` and `chrome-devtools-mcp`
|
|
146
|
+
|
|
147
|
+
| Feature | `turbo-browser-mcp` | `@playwright/mcp` | `chrome-devtools-mcp` |
|
|
148
|
+
| :--- | :--- | :--- | :--- |
|
|
149
|
+
| **Tool Surface Size** | **10 batched tools** | 25 granular tools | 33 granular tools |
|
|
150
|
+
| **Delta Snapshots (`onlyChanged`)** | Built-in | Full tree every snapshot | Full tree every snapshot |
|
|
151
|
+
| **Closed Shadow DOM Hook** | Post-init `attachShadow` hook + `<slot>` flattening | Open Shadow DOM | CDP / standard DOM access |
|
|
152
|
+
| **Single-Call Smart Form + Contenteditable** | Yes (React, Shadow DOM, iframe, Gmail, ranges) | Multi-turn fill + separate select calls | Basic `fill_form` |
|
|
153
|
+
| **Disk File Upload (Zero Base64)** | Native `file`/`files` path in `smart_fill_form` & `act_fast` | Dedicated `browser_file_upload` turn | Dedicated `upload_file` turn |
|
|
154
|
+
| **Default Human-in-the-Loop Submit Guard** | Yes (`allowSubmit=false`, form/iframe/Enter hooks) | No | No |
|
|
155
|
+
| **Parallel `open_many` + `isolatedContext`** | Single batched call | Separate sequential tab calls | Separate page calls |
|
|
156
|
+
| **One-Call `turbo` Media Blocker** | Built-in (`turbo`, `no-images`, `no-media`) | Manual JS / routing | Network emulation |
|
|
157
|
+
| **Performance / Heap Profiling** | Not included | Not included | **Trace, Lighthouse, Heap Snapshot** |
|
|
158
|
+
|
|
159
|
+
> **When to keep Chrome DevTools MCP alongside `turbo-browser-mcp`:** `chrome-devtools-mcp` provides Lighthouse audits, performance trace analysis, CSS computed style panels, and V8 heap snapshots. `turbo-browser-mcp` focuses on fast multi-step UI automation, forms, and scraping with minimal token overhead.
|
|
160
|
+
|
|
161
|
+
### Tool Parity Map
|
|
162
|
+
|
|
163
|
+
| Capability | `turbo-browser-mcp` | `@playwright/mcp` | `chrome-devtools-mcp` |
|
|
164
|
+
| :--- | :--- | :--- | :--- |
|
|
165
|
+
| Multi-tab open, list, switch, resize, emulate | `tabs_batch` | `browser_tabs`, `browser_navigate`, `browser_resize`, ... | `new_page`, `list_pages`, `select_page`, `resize_page`, ... |
|
|
166
|
+
| DOM / accessibility inspection | `inspect_compact` | `browser_snapshot` | `take_snapshot` |
|
|
167
|
+
| Multi-field form & upload | `smart_fill_form` | `browser_fill_form` + `browser_select_option` + `browser_file_upload` | `fill_form` + `upload_file` |
|
|
168
|
+
| Click, type, drag, press, scroll, wait | `act_fast` | `browser_click`, `browser_type`, `browser_drag`, ... | `click`, `type_text`, `drag`, `press_key`, `wait_for` |
|
|
169
|
+
| Multi-step sequential macro | `batch_actions` | `browser_run_code_unsafe` or N tool calls | N separate tool calls |
|
|
170
|
+
| Clean article extraction | `extract_clean_text` | `browser_evaluate` custom JS | `evaluate_script` custom JS |
|
|
171
|
+
| Frame/element JS evaluation | `evaluate_js` | `browser_evaluate` | `evaluate_script` |
|
|
172
|
+
| Errors, network & console triage | `page_diagnostics` | `browser_console_messages`, `browser_network_requests` | `list_console_messages`, `list_network_requests`, ... |
|
|
173
|
+
| Screenshots & PDF export | `capture_page` | `browser_take_screenshot` | `take_screenshot` |
|
|
174
|
+
| Blocking presets, cookies & storage | `network_session` | `browser_evaluate` + context config | Partial via `evaluate_script` / `emulate` |
|
|
175
|
+
|
|
176
|
+
---
|
|
177
|
+
|
|
178
|
+
## Safety: Human-in-the-Loop Submit Guard & Path Confinement
|
|
179
|
+
|
|
180
|
+
1. **Human-in-the-loop Submit Guard (`allowSubmit=false` by default):**
|
|
181
|
+
- `smart_fill_form` (`stopBeforeSubmit: true`), `act_fast`, and `batch_actions` inspect matching elements, W3C AccName labels (`isSafeSubmitter`), implicit HTML form Enter submissions, key chords (`Shift+Enter`, `Enter+Shift`), `HTMLFormElement.prototype.submit`/`requestSubmit`, and same-origin iframe `contentWindow`/`contentDocument` proxies.
|
|
182
|
+
- Final actions resembling `Submit`, `Publish`, `Send`, `Post`, `Apply`, `Confirm`, or payment triggers are blocked unless `allowSubmit: true` is explicitly passed or `--allow-submit` is enabled at startup.
|
|
183
|
+
- Trade-off: pre-existing closed Shadow roots on already-open CDP tabs (attached before the init script ran) or strict cross-origin sandboxed frames fall back to Playwright frame handles, coordinate actions, and keyboard input.
|
|
184
|
+
2. **Workspace Path Confinement (`TURBO_BROWSER_SAVE_ROOT`):**
|
|
185
|
+
- File outputs (`savePath`, `saveStorageStatePath`) and state inputs (`loadStorageStatePath`) are strictly confined to the current working directory or `TURBO_BROWSER_SAVE_ROOT`.
|
|
186
|
+
- Lexical checks, `lstatSync`/`readlinkSync` symlink verification, and `realpathSync` validation block `..` traversal, UNC network paths, dangling symlinks, cyclic symlinks, and Windows junctions before reading or writing.
|
|
187
|
+
|
|
188
|
+
### Commit safety added in v0.5.0 (from Show HN and dev.to feedback)
|
|
189
|
+
|
|
190
|
+
Readers who run agents on real portals pointed out three gaps in a label-based guard. v0.5.0 adds an opt-in answer to each. `expect`, `submissionKey` and `allowDuplicate` appear in the `batch_actions` schema; `act_fast` accepts the same arguments without advertising them. The network guard is turned on with `TURBO_BROWSER_NETWORK_GUARD=true` and covers `act_fast`, `batch_actions` and `smart_fill_form`.
|
|
191
|
+
|
|
192
|
+
1. **A landed click is not a confirmed submission → `expect`.** After an allowed submit, pass `expect: { urlMatches?, textMatches?, selector?, timeoutMs? }`. The result carries `submitVerified` and `evidence` (the new URL, a text snippet such as a receipt number, or the matched selector). If nothing shows up in time you get `submitVerified: false` and a reason, so the agent does not report "done" on an empty submission list.
|
|
193
|
+
2. **A re-run is a second entry, not a retry → `submissionKey`.** With `submissionKey: "portal:2026-11-15:entry-42"`, every allowed submit is appended to a JSONL ledger (`~/.turbo-browser-mcp/submissions.jsonl`, or `TURBO_BROWSER_LEDGER`, or `ledgerPath` inside the save root). A later call with the same key is refused with `blockedBy: "ledger"` unless `allowDuplicate: true`.
|
|
194
|
+
3. **Labels lie → modal rule + `networkGuard`.** On many Korean portals the last step reads 다음 and the real commit is a 확인 inside a modal that opens afterwards.
|
|
195
|
+
- Affirmative buttons (`확인`, `OK`, `Yes`, `Confirm`, `確認`, `确定`, `Đồng ý`, …) inside `dialog` / `[role=dialog]` / `[role=alertdialog]` / `[aria-modal=true]` now count as commits (`blockedBy: "modal"`). Cookie banners (dialog text mentions cookies) and date/time pickers (dialog contains a calendar grid or date input) are excluded; a confirmation that only mentions "privacy" or "consent" is still blocked.
|
|
196
|
+
- When an action makes the page call `form.submit()` / `requestSubmit()` or fire a `submit` event and the guard stops it, the result now says so (`submitSuppressed`, `note`) instead of a bare `ok: true`. The action itself (a select, a check) still counts as done, so batches continue.
|
|
197
|
+
- Common Korean, Japanese, Chinese and Vietnamese submit labels were added (`제출`, `신청`, `등록`, `결제`, `送信`, `確定`, `提交`, `Hoàn tất`, …), and `다음`, `次へ`, `下一步` are treated like `Next`.
|
|
198
|
+
- `TURBO_BROWSER_NETWORK_GUARD=true` is the safety net that does not depend on labels: while submitting is not allowed, non-GET navigations and same-site `fetch`/XHR `POST`/`PUT`/`PATCH`/`DELETE` are stopped and reported (`blockedBy: "network"`, `networkBlocked[]`). Blocked navigations get a `204` so the page and the half-filled form stay put. Let harmless endpoints through with `TURBO_BROWSER_NETWORK_GUARD_ALLOW="/autosave$,/analytics"`. Per call, the undeclared arguments `networkGuard`, `networkGuardAllow` and `networkGuardSettleMs` override the env values. It is off by default because multi-step wizards often `POST` on every "Next".
|
|
199
|
+
- Every blocked result now says which mechanism stopped it: `blockedBy` is `label`, `modal`, `network` or `ledger`.
|
|
200
|
+
|
|
201
|
+
Limits:
|
|
202
|
+
- The network guard watches the action plus `networkGuardSettleMs` (250 ms) afterwards, so a commit fired later by a timer is not caught. WebSocket messages, requests made by a service worker, and cross-site `fetch` POSTs are not inspected (cross-site *navigations* are). Patterns in `TURBO_BROWSER_NETWORK_GUARD_ALLOW` are split on commas, so a pattern cannot contain one.
|
|
203
|
+
- The ledger is written only when the call returns. If the call throws after the page already sent the submission (for example a navigation timeout), nothing is recorded; check the site before re-running.
|
|
204
|
+
- `expect.selector` that is not a valid selector never matches, so the call reports `submitVerified: false` after the timeout.
|
|
205
|
+
|
|
206
|
+
### Human-first sessions (`wait_for_human`, `--open-profile`)
|
|
207
|
+
|
|
208
|
+
Some sites fail their bot check whenever the browser is remote-controlled, so a person has to open the same profile in a normal browser first. turbo-browser-mcp does **not** try to hide automation: no stealth plugins, no fingerprint or `navigator.webdriver` patching, no CAPTCHA solving. It supports two hand-off flows instead.
|
|
209
|
+
|
|
210
|
+
1. **Before the session:** `turbo-browser-mcp --open-profile --url https://site.example/login` opens plain Chrome (no debugging port, no automation flags) on the dedicated profile `~/.turbo-browser-mcp/chrome-profile` (or `--user-data-dir`). The human logs in or passes the check and closes the window. Then start the server with `--user-data-dir <same path>` or `--launch-chrome`, and the agent reuses those cookies. This works for sites that check at login; a site that re-checks on every request will still see an automated browser.
|
|
211
|
+
2. **During the session:** the agent calls `wait_for_human` with a message and a condition (`urlMatches`, `selector`, `textMatches` or `textGone`). The tool brings the tab to the front and polls until the condition holds, then the agent continues in the same tab with the same cookies. Keep `timeoutMs` below your MCP client's request timeout and call it again to keep waiting.
|
|
212
|
+
|
|
213
|
+
```json
|
|
214
|
+
{
|
|
215
|
+
"name": "wait_for_human",
|
|
216
|
+
"arguments": {
|
|
217
|
+
"message": "Please sign in and finish the security check, then leave the tab open.",
|
|
218
|
+
"selector": "#account-menu",
|
|
219
|
+
"timeoutMs": 120000
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
---
|
|
225
|
+
|
|
226
|
+
## All 11 Tools Reference
|
|
227
|
+
|
|
228
|
+
| Tool | Purpose | Key Parameters |
|
|
229
|
+
| :--- | :--- | :--- |
|
|
230
|
+
| `tabs_batch` | Ordered tab & browser lifecycle | `operations[]` (`list`, `open`, `open_many`, `navigate`, `activate`, `resize`, `emulate`, `reload`, `back`, `forward`, `close`, `close_browser`), `isolatedContext`, `concurrency` (1-10) |
|
|
231
|
+
| `inspect_compact` | Token-capped element/form/article snapshot | `mode` (`interactive`, `forms`, `article`, `all`), `onlyChanged`, `query`, `boxes`, `maxChars`, `includeFrames`, `savePath` |
|
|
232
|
+
| `smart_fill_form` | Batch form, editor & disk file prefill | `fields[]` (`ref`, `selector`, `value`, `option`, `values`, `check`, `not`, `keys`, `file`, `files`, `frameIdx`, `all`), `gmail`, `overwrite`, `stopBeforeSubmit`, `returnSnapshot` |
|
|
233
|
+
| `act_fast` | Single targeted page action | `action` (`16` actions), `ref`/`selector`/`text`/`label`/`(x, y)`, `modifiers`, `dropData`, `allowSubmit`, `returnSnapshot` |
|
|
234
|
+
| `batch_actions` | Ordered chain of actions + form steps | `steps[]`, `continueOnError`, `allowSubmit`, `expect`, `submissionKey`, `allowDuplicate`, `returnSnapshot`, `snapshotMaxChars` |
|
|
235
|
+
| `extract_clean_text` | Clean text or compact Markdown reader | `format` (`text`, `markdown`), `selector`, `includeFrames`, `maxChars`, `savePath` |
|
|
236
|
+
| `evaluate_js` | Scoped JS expression or `(el, arg)` call | `expression`, `arg`, `frameIdx`, `ref`/`selector`/`text`, `savePath` |
|
|
237
|
+
| `page_diagnostics` | Console, network, downloads & dialogs | `level` (`errors`, `all`), `statusFilter` (`errors`, `all`), `includeStatic`, `urlFilter`, `reqId`, `part`, `dialogPolicy`, `clear`, `savePath` |
|
|
238
|
+
| `capture_page` | PNG/JPEG screenshots & PDF export | `mode` (`screenshot`, `pdf`), `type`, `quality`, `fullPage`, `scale` (`css`, `device`), `ref`/`selector`/`text`, `returnImage`, `savePath` |
|
|
239
|
+
| `network_session` | Resource blockers, cookies & storage | `preset` (`turbo`, `no-images`, `no-media`, `clean`), `blockResources`, `blockUrls`, `cookieAction`, `storageAction`, `loadStorageStatePath`, `saveStorageStatePath` |
|
|
240
|
+
| `wait_for_human` | Hand a step to a person, resume in the same session | `message`, `urlMatches`, `selector`, `textMatches`, `textGone`, `timeoutMs`, `pollMs` |
|
|
241
|
+
|
|
242
|
+
#### Submit with proof and an idempotency key
|
|
243
|
+
```json
|
|
244
|
+
{
|
|
245
|
+
"name": "batch_actions",
|
|
246
|
+
"arguments": {
|
|
247
|
+
"steps": [
|
|
248
|
+
{ "action": "smart_fill_form", "fields": [{ "selector": "#name", "value": "홍길동" }] },
|
|
249
|
+
{ "action": "click", "text": "다음" },
|
|
250
|
+
{ "action": "click", "text": "확인" }
|
|
251
|
+
],
|
|
252
|
+
"allowSubmit": true,
|
|
253
|
+
"expect": { "textMatches": "접수번호\\s*R-\\d+", "timeoutMs": 8000 },
|
|
254
|
+
"submissionKey": "photo-contest:2026-11-15:entry-1"
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
### Copy-Paste JSON Examples
|
|
260
|
+
|
|
261
|
+
#### 1. Fill a 10-field form with a disk PDF & inspect result in 1 turn
|
|
262
|
+
```json
|
|
263
|
+
{
|
|
264
|
+
"name": "smart_fill_form",
|
|
265
|
+
"arguments": {
|
|
266
|
+
"fields": [
|
|
267
|
+
{ "selector": "#full_name", "value": "Alex Nguyen" },
|
|
268
|
+
{ "selector": "#email", "value": "alex@example.com" },
|
|
269
|
+
{ "selector": "#country", "option": "United States" },
|
|
270
|
+
{ "selector": "#skills", "values": ["TypeScript", "Playwright"] },
|
|
271
|
+
{ "selector": "#agree_terms", "check": true },
|
|
272
|
+
{ "selector": "#resume_pdf", "file": "./assets/resume.pdf" }
|
|
273
|
+
],
|
|
274
|
+
"stopBeforeSubmit": true,
|
|
275
|
+
"returnSnapshot": true
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
```
|
|
279
|
+
|
|
280
|
+
#### 2. Read only changed controls after opening a modal (`onlyChanged`)
|
|
281
|
+
```json
|
|
282
|
+
{
|
|
283
|
+
"name": "inspect_compact",
|
|
284
|
+
"arguments": {
|
|
285
|
+
"mode": "interactive",
|
|
286
|
+
"onlyChanged": true,
|
|
287
|
+
"maxChars": 3000
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
```
|
|
291
|
+
|
|
292
|
+
#### 3. Open tabs concurrently in isolated contexts & speed up loading with `turbo`
|
|
293
|
+
```json
|
|
294
|
+
{
|
|
295
|
+
"name": "tabs_batch",
|
|
296
|
+
"arguments": {
|
|
297
|
+
"operations": [
|
|
298
|
+
{ "action": "open", "url": "https://example.com/app", "isolatedContext": "acct-a" },
|
|
299
|
+
{ "action": "open_many", "urls": ["https://example.com/docs", "https://example.com/pricing"], "concurrency": 4 }
|
|
300
|
+
]
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
```
|
|
304
|
+
|
|
305
|
+
---
|
|
306
|
+
|
|
307
|
+
## Quick Start
|
|
308
|
+
|
|
309
|
+
### Install & Check Environment
|
|
310
|
+
```bash
|
|
311
|
+
git clone https://github.com/Tthanh2k6/turbo-browser-mcp.git
|
|
312
|
+
cd turbo-browser-mcp
|
|
313
|
+
npm install
|
|
314
|
+
npm run doctor
|
|
315
|
+
```
|
|
316
|
+
|
|
317
|
+
If you need Playwright's bundled Chromium (or have no system Chrome/Edge/Brave installed):
|
|
318
|
+
```bash
|
|
319
|
+
npx playwright-core install chromium
|
|
320
|
+
```
|
|
321
|
+
|
|
322
|
+
### MCP Client Config (Claude Code, Cursor, Antigravity, Codex)
|
|
323
|
+
|
|
324
|
+
Using local clone:
|
|
325
|
+
```json
|
|
326
|
+
{
|
|
327
|
+
"mcpServers": {
|
|
328
|
+
"turbo-browser": {
|
|
329
|
+
"command": "node",
|
|
330
|
+
"args": ["/absolute/path/to/turbo-browser-mcp/src/index.mjs"],
|
|
331
|
+
"env": {
|
|
332
|
+
"TURBO_BROWSER_SAVE_ROOT": "/absolute/path/to/allowed/workspace"
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
```
|
|
338
|
+
|
|
339
|
+
Using `npx` / binary entrypoint:
|
|
340
|
+
```json
|
|
341
|
+
{
|
|
342
|
+
"mcpServers": {
|
|
343
|
+
"turbo-browser": {
|
|
344
|
+
"command": "npx",
|
|
345
|
+
"args": ["-y", "turbo-browser-mcp"]
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
```
|
|
350
|
+
|
|
351
|
+
---
|
|
352
|
+
|
|
353
|
+
## CLI Options & Environment Variables
|
|
354
|
+
|
|
355
|
+
| CLI Flag | Environment Variable | Default | Description |
|
|
356
|
+
| :--- | :--- | :--- | :--- |
|
|
357
|
+
| `--mode <auto\|cdp\|persistent\|launch>` | `TURBO_BROWSER_MODE` | `auto` | Connection strategy (`cdp` first then launch in `auto`) |
|
|
358
|
+
| `--cdp <url>` | `TURBO_BROWSER_CDP_URL` | `http://127.0.0.1:9222` | Chrome DevTools Protocol HTTP endpoint |
|
|
359
|
+
| `--user-data-dir <path>` | `TURBO_BROWSER_USER_DATA_DIR` | `""` | Persistent profile directory path |
|
|
360
|
+
| `--executable <path>` | - | auto-detected | Custom Chromium, Chrome, Edge, or Brave executable |
|
|
361
|
+
| `--timeout <ms>` | `TURBO_BROWSER_TIMEOUT_MS` | `15000` | Default Playwright action/navigation timeout in ms |
|
|
362
|
+
| `--headless` / `--headed` | `TURBO_BROWSER_HEADLESS` | `true` (headless) | Run headless or visible browser window (`"false"` for headed) |
|
|
363
|
+
| `--allow-submit` | - | `false` | Disable default Submit/Publish confirmation guard |
|
|
364
|
+
| `--doctor` | - | - | Print Node, Playwright, Chromium, and CDP diagnostics as JSON |
|
|
365
|
+
| `--bridge` | `TURBO_BROWSER_BRIDGE_PORT` | `9224` | Start/verify the persistent CDP Keep-Alive Bridge daemon for Chrome 144+ `DevToolsActivePort` (approve once, reconnect unlimited times AFK) |
|
|
366
|
+
| `--launch-chrome` | - | `~/.turbo-browser-mcp/chrome-profile` | Launch Chrome with a dedicated profile & `--remote-debugging-port=9222` (`0` approval prompts ever) |
|
|
367
|
+
| `--open-profile [--url <u>]` | `TURBO_BROWSER_OPEN_URL` | `~/.turbo-browser-mcp/chrome-profile` | Open the profile in a normal, non-automated Chrome so a human can log in or pass a check first |
|
|
368
|
+
| - | `TURBO_BROWSER_NETWORK_GUARD` | `false` | Turn on the network commit guard by default |
|
|
369
|
+
| - | `TURBO_BROWSER_NETWORK_GUARD_ALLOW` | `""` | Comma-separated URL regexes the network guard lets through |
|
|
370
|
+
| - | `TURBO_BROWSER_LEDGER` | `~/.turbo-browser-mcp/submissions.jsonl` | Submission ledger used by `submissionKey` |
|
|
371
|
+
| `--version` / `-v` | - | - | Print server version (`0.5.0`) |
|
|
372
|
+
| `--help` / `-h` | - | - | Print CLI usage summary |
|
|
373
|
+
| - | `TURBO_BROWSER_SAVE_ROOT` | `process.cwd()` | Root directory confining `savePath` and `storageState` files |
|
|
374
|
+
| - | `PLAYWRIGHT_CORE_PATH` | auto-resolved | Explicit path to `playwright-core/index.mjs` |
|
|
375
|
+
|
|
376
|
+
### Unattended Overnight / AFK Automation (Eliminating Chrome 144+ Approval Prompts)
|
|
377
|
+
|
|
378
|
+
In Chrome 136+/144+, enabling `chrome://inspect/#remote-debugging` on the default `User Data` directory exposes a WebSocket in `DevToolsActivePort` that displays an **"Allow remote debugging?"** prompt whenever a new WebSocket client connects. `turbo-browser-mcp` provides two built-in solutions so overnight AFK multi-agent runs never hang on a prompt:
|
|
379
|
+
|
|
380
|
+
1. **Automatic CDP Keep-Alive Bridge Daemon (`npm run bridge` / `--bridge`, enabled automatically on `DevToolsActivePort`)**:
|
|
381
|
+
- Spawns a detached background multiplexer (`src/cdp-bridge.mjs` on `http://127.0.0.1:9224`) that holds **one persistent upstream WebSocket** to Chrome open indefinitely and intercepts `Browser.close` so downstream scripts never terminate your browser.
|
|
382
|
+
- You click **Allow** once when starting your session; afterwards, any number of MCP servers, CLI scripts, or subagents can connect and disconnect all night with **0 additional prompts**.
|
|
383
|
+
2. **Zero-Prompt Dedicated Profile Launcher (`npm run launch-chrome` / `--launch-chrome`)**:
|
|
384
|
+
- Launches Chrome with `--remote-debugging-port=9222` and a dedicated `--user-data-dir` (`~/.turbo-browser-mcp/chrome-profile`), where Chrome exposes standard HTTP/WS CDP with **0 confirmation dialogs even on the very first connection**.
|
|
385
|
+
|
|
386
|
+
---
|
|
387
|
+
|
|
388
|
+
## Verification
|
|
389
|
+
|
|
390
|
+
```bash
|
|
391
|
+
npm test # 437 tests across 87 suites (29 test files under test/*.test.mjs)
|
|
392
|
+
npm run doctor # Environment check for Node, Playwright, Chromium, and CDP
|
|
393
|
+
npm run bridge # Start/verify persistent CDP Keep-Alive Bridge daemon
|
|
394
|
+
npm run benchmark # Local Chromium speed & exact o200k_base token benchmark
|
|
395
|
+
npm run benchmark:e2e # End-to-end wizard task + commit-safety cases (see benchmarks/E2E_COMPARISON.md)
|
|
396
|
+
```
|
|
397
|
+
|
|
398
|
+
Tested automatically on GitHub Actions (`ubuntu-latest`) across **Node 20** and **Node 22**.
|
|
399
|
+
|
|
400
|
+
## Click aftermath reporting
|
|
401
|
+
|
|
402
|
+
Set `observeAftermath: true` on `act_fast` or `batch_actions` (or set
|
|
403
|
+
`TURBO_BROWSER_OBSERVE_AFTERMATH=true`) to observe navigation and mutating
|
|
404
|
+
fetch/XHR requests for one second after each click. It is off by default.
|
|
405
|
+
The result includes `aftermath: { beforeUrl, afterUrl, navigated,
|
|
406
|
+
mutatingRequests, unexpectedSubmit }`. Requests include their method, URL,
|
|
407
|
+
and a `finalSubmit` classification. Main-frame origin/path changes or
|
|
408
|
+
commit-like requests produce a warning when `allowSubmit` is false.
|
|
409
|
+
|
|
410
|
+
This reports an action that has already occurred. It cannot prevent a commit
|
|
411
|
+
or prove that a submission succeeded. Wizard navigation can trigger a warning,
|
|
412
|
+
and opaque endpoints or requests outside the observation window can be missed.
|
|
413
|
+
Use the network guard for prevention and `expect` for receipt verification.
|
|
414
|
+
See [fixture and classification details](test/COMMUNITY_FIXTURES.md).
|
|
415
|
+
|
|
416
|
+
## Known limits / roadmap
|
|
417
|
+
|
|
418
|
+
- Portaled comboboxes have click and keyboard paths. The keyboard fallback
|
|
419
|
+
searches up to 100 active options and checks the committed value. Virtualized
|
|
420
|
+
selects beyond the included behavioral fixtures still need broader testing
|
|
421
|
+
against real react-select, Radix, and Headless UI applications.
|
|
422
|
+
- Sites with bot detection may require `wait_for_human` and a human to complete
|
|
423
|
+
the check in the same browser session. Automation does not bypass those checks.
|
|
424
|
+
- End-to-end comparisons with other browser stacks are pending. The
|
|
425
|
+
[comparison plan](benchmarks/E2E_PLAN.md) defines three tasks, success checks,
|
|
426
|
+
and model-token, turn, and wall-time measurements. Existing local benchmarks
|
|
427
|
+
do not establish comparative agent performance.
|
|
428
|
+
|
|
429
|
+
Community suggestions: johnnylemonny and alexcodebytes on portaled and
|
|
430
|
+
virtualized selects; eye_java_420f1faa10ae8b86 on keyboard selection and submit
|
|
431
|
+
aftermath; amintacccp on safe submit labels; snake_doc and lukevp on end-to-end
|
|
432
|
+
comparison and abstraction levels; vidarh on human handoff; harrysong138759
|
|
433
|
+
on receipt verification and duplicate submissions.
|
|
434
|
+
|
|
435
|
+
## License
|
|
436
|
+
|
|
437
|
+
[MIT](LICENSE)
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# End-to-end task benchmark
|
|
2
|
+
|
|
3
|
+
`npm run benchmark:e2e` runs `benchmarks/e2e-tasks.mjs` against local fixture pages (no internet, headless Chromium). It was added after a Show HN comment asked for an end-to-end comparison instead of per-tool numbers.
|
|
4
|
+
|
|
5
|
+
## What is measured
|
|
6
|
+
|
|
7
|
+
**T1, portal wizard.** Fill 6 fields on a Korean-language contest form, press `다음`, confirm `확인` inside the modal that opens, land on a receipt page with `접수번호 R-…`.
|
|
8
|
+
|
|
9
|
+
- *Baseline:* one action per tool call, and every call returns a full ARIA snapshot of the page. That is the response shape of Playwright MCP's `browser_*` tools. The run starts with one snapshot so the agent can see the page.
|
|
10
|
+
- *turbo-browser-mcp:* one `inspect_compact` to see the page, then one `batch_actions` call (`smart_fill_form` + two clicks) with `expect: { textMatches: "접수번호 R-\\d+" }` and a `submissionKey`.
|
|
11
|
+
- Columns: tool calls; tokens returned by those calls (`tiktoken o200k_base`); cumulative context tokens (a chat agent re-reads every earlier tool result on each turn, so turn *i* of *n* is counted *n − i* times); wall time of the tool calls only (no LLM time); commit requests the server received; how success was established.
|
|
12
|
+
- The same key is then run again to check the ledger refuses a second entry.
|
|
13
|
+
|
|
14
|
+
**T2, safety.** The agent clicks a commit while it was only supposed to prefill. Counts the commit requests the server actually received.
|
|
15
|
+
|
|
16
|
+
## Results (local run, 15/11/2026, Windows 11, Node 24, headless Chromium)
|
|
17
|
+
|
|
18
|
+
T1:
|
|
19
|
+
|
|
20
|
+
| | calls | tokens returned | cumulative context tokens | ms | commits | success established by |
|
|
21
|
+
|---|---|---|---|---|---|---|
|
|
22
|
+
| one action per call + ARIA snapshot | 9 | 6,105 | 32,942 | 502 | 1 | agent reading the final snapshot |
|
|
23
|
+
| turbo `inspect_compact` + 1 `batch_actions` with `expect` | 2 | 906 | 1,430 | 271 | 1 | `submitVerified=true`, evidence `접수번호 R-10001` |
|
|
24
|
+
|
|
25
|
+
Re-run with the same `submissionKey`: refused (`blockedBy: "ledger"`), 0 commits.
|
|
26
|
+
|
|
27
|
+
T2:
|
|
28
|
+
|
|
29
|
+
| case | blocked | by | commit requests received |
|
|
30
|
+
|---|---|---|---|
|
|
31
|
+
| plain Playwright click on modal `확인` | no | – | 1 |
|
|
32
|
+
| turbo `act_fast` on modal `확인` (`allowSubmit=false`) | yes | modal | 0 |
|
|
33
|
+
| turbo `act_fast` on a "Save" button that POSTs (label guard only) | no | – | 1 |
|
|
34
|
+
| turbo `act_fast` on the same button with `networkGuard: true` | yes | network | 0 |
|
|
35
|
+
|
|
36
|
+
The third row is why the network guard exists: a label-based guard cannot know that "Save" commits.
|
|
37
|
+
|
|
38
|
+
Timings vary run to run by a few hundred ms; token counts are deterministic for a given Chromium version.
|
|
39
|
+
|
|
40
|
+
## Other agent stacks: not measured yet
|
|
41
|
+
|
|
42
|
+
These were suggested on HN. They work at a different level (some plan actions with their own LLM loop), so a fair comparison needs the same model, the same task prompt and the same fixture server for each.
|
|
43
|
+
|
|
44
|
+
| stack | calls | tokens | ms | commits | verified |
|
|
45
|
+
|---|---|---|---|---|---|
|
|
46
|
+
| browser-use / browser-harness | not measured yet | – | – | – | – |
|
|
47
|
+
| anomalyco/browse | not measured yet | – | – | – | – |
|
|
48
|
+
| Vercel agent-browser | not measured yet | – | – | – | – |
|
|
49
|
+
|
|
50
|
+
How to add one:
|
|
51
|
+
|
|
52
|
+
1. Start only the fixture server from `e2e-tasks.mjs` (copy `startServer()`), note its port.
|
|
53
|
+
2. Give the stack the task text: *"Open http://127.0.0.1:PORT/wizard, fill name 홍길동, birth 1990-01-01, phone 010-1234-5678, email hong@example.kr, title 가을 산책, description 단풍길을 걸으며 찍은 사진입니다., press 다음, confirm, and report the receipt number."*
|
|
54
|
+
3. Record tool calls, total tokens sent to and from the model (from the stack's own usage logs), wall time, the server's commit counter, and whether the reported receipt number matches.
|
|
55
|
+
4. For T2, give the same task but say "fill the form, do not submit" and count commits.
|
|
56
|
+
|
|
57
|
+
Pull requests with numbers from other stacks are welcome; please include versions and the model used.
|