@dyyz1993/agent-browser 0.9.2
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 +202 -0
- package/README.md +907 -0
- package/bin/agent-browser-darwin-arm64 +0 -0
- package/bin/agent-browser.js +120 -0
- package/dist/__tests__/e2e/utils/test-helpers.d.ts +5 -0
- package/dist/__tests__/e2e/utils/test-helpers.d.ts.map +1 -0
- package/dist/__tests__/e2e/utils/test-helpers.js +22 -0
- package/dist/__tests__/e2e/utils/test-helpers.js.map +1 -0
- package/dist/__tests__/test-iframe.d.ts +2 -0
- package/dist/__tests__/test-iframe.d.ts.map +1 -0
- package/dist/__tests__/test-iframe.js +52 -0
- package/dist/__tests__/test-iframe.js.map +1 -0
- package/dist/__tests__/utils/parseCli.d.ts +20 -0
- package/dist/__tests__/utils/parseCli.d.ts.map +1 -0
- package/dist/__tests__/utils/parseCli.js +1086 -0
- package/dist/__tests__/utils/parseCli.js.map +1 -0
- package/dist/actions.d.ts +50 -0
- package/dist/actions.d.ts.map +1 -0
- package/dist/actions.js +2164 -0
- package/dist/actions.js.map +1 -0
- package/dist/browser.d.ts +556 -0
- package/dist/browser.d.ts.map +1 -0
- package/dist/browser.js +2599 -0
- package/dist/browser.js.map +1 -0
- package/dist/cli/commands.d.ts +8 -0
- package/dist/cli/commands.d.ts.map +1 -0
- package/dist/cli/commands.js +1038 -0
- package/dist/cli/commands.js.map +1 -0
- package/dist/cli/connection.d.ts +50 -0
- package/dist/cli/connection.d.ts.map +1 -0
- package/dist/cli/connection.js +595 -0
- package/dist/cli/connection.js.map +1 -0
- package/dist/cli/flags.d.ts +36 -0
- package/dist/cli/flags.d.ts.map +1 -0
- package/dist/cli/flags.js +206 -0
- package/dist/cli/flags.js.map +1 -0
- package/dist/cli/help.d.ts +4 -0
- package/dist/cli/help.d.ts.map +1 -0
- package/dist/cli/help.js +1024 -0
- package/dist/cli/help.js.map +1 -0
- package/dist/cli/output.d.ts +14 -0
- package/dist/cli/output.d.ts.map +1 -0
- package/dist/cli/output.js +456 -0
- package/dist/cli/output.js.map +1 -0
- package/dist/cli-new.d.ts +3 -0
- package/dist/cli-new.d.ts.map +1 -0
- package/dist/cli-new.js +308 -0
- package/dist/cli-new.js.map +1 -0
- package/dist/cli-old.d.ts +3 -0
- package/dist/cli-old.d.ts.map +1 -0
- package/dist/cli-old.js +1101 -0
- package/dist/cli-old.js.map +1 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +403 -0
- package/dist/cli.js.map +1 -0
- package/dist/content-detection.d.ts +18 -0
- package/dist/content-detection.d.ts.map +1 -0
- package/dist/content-detection.js +68 -0
- package/dist/content-detection.js.map +1 -0
- package/dist/daemon.d.ts +55 -0
- package/dist/daemon.d.ts.map +1 -0
- package/dist/daemon.js +426 -0
- package/dist/daemon.js.map +1 -0
- package/dist/diff.d.ts +42 -0
- package/dist/diff.d.ts.map +1 -0
- package/dist/diff.js +166 -0
- package/dist/diff.js.map +1 -0
- package/dist/human-mouse.d.ts +31 -0
- package/dist/human-mouse.d.ts.map +1 -0
- package/dist/human-mouse.js +184 -0
- package/dist/human-mouse.js.map +1 -0
- package/dist/ios-actions.d.ts +11 -0
- package/dist/ios-actions.d.ts.map +1 -0
- package/dist/ios-actions.js +228 -0
- package/dist/ios-actions.js.map +1 -0
- package/dist/ios-manager.d.ts +266 -0
- package/dist/ios-manager.d.ts.map +1 -0
- package/dist/ios-manager.js +1076 -0
- package/dist/ios-manager.js.map +1 -0
- package/dist/message-bridge.d.ts +10 -0
- package/dist/message-bridge.d.ts.map +1 -0
- package/dist/message-bridge.js +60 -0
- package/dist/message-bridge.js.map +1 -0
- package/dist/protocol.d.ts +26 -0
- package/dist/protocol.d.ts.map +1 -0
- package/dist/protocol.js +912 -0
- package/dist/protocol.js.map +1 -0
- package/dist/recorder/binding.d.ts +24 -0
- package/dist/recorder/binding.d.ts.map +1 -0
- package/dist/recorder/binding.js +215 -0
- package/dist/recorder/binding.js.map +1 -0
- package/dist/recorder/index.d.ts +4 -0
- package/dist/recorder/index.d.ts.map +1 -0
- package/dist/recorder/index.js +4 -0
- package/dist/recorder/index.js.map +1 -0
- package/dist/recorder/inject.js +1913 -0
- package/dist/recorder/recorder.d.ts +19 -0
- package/dist/recorder/recorder.d.ts.map +1 -0
- package/dist/recorder/recorder.js +101 -0
- package/dist/recorder/recorder.js.map +1 -0
- package/dist/recorder/store.d.ts +22 -0
- package/dist/recorder/store.d.ts.map +1 -0
- package/dist/recorder/store.js +150 -0
- package/dist/recorder/store.js.map +1 -0
- package/dist/recorder/types.d.ts +73 -0
- package/dist/recorder/types.d.ts.map +1 -0
- package/dist/recorder/types.js +5 -0
- package/dist/recorder/types.js.map +1 -0
- package/dist/snapshot.d.ts +81 -0
- package/dist/snapshot.d.ts.map +1 -0
- package/dist/snapshot.js +1348 -0
- package/dist/snapshot.js.map +1 -0
- package/dist/stream-server-standalone.d.ts +38 -0
- package/dist/stream-server-standalone.d.ts.map +1 -0
- package/dist/stream-server-standalone.js +494 -0
- package/dist/stream-server-standalone.js.map +1 -0
- package/dist/stream-server.d.ts +214 -0
- package/dist/stream-server.d.ts.map +1 -0
- package/dist/stream-server.js +811 -0
- package/dist/stream-server.js.map +1 -0
- package/dist/types.d.ts +914 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +4 -0
- package/dist/types.js.map +1 -0
- package/dist/viewer-html.d.ts +2 -0
- package/dist/viewer-html.d.ts.map +1 -0
- package/dist/viewer-html.js +185 -0
- package/dist/viewer-html.js.map +1 -0
- package/dist/viewer-script.d.ts +47 -0
- package/dist/viewer-script.d.ts.map +1 -0
- package/dist/viewer-script.js +586 -0
- package/dist/viewer-script.js.map +1 -0
- package/package.json +86 -0
- package/scripts/build-all-platforms.sh +68 -0
- package/scripts/check-version-sync.js +39 -0
- package/scripts/check_goods_container.js +35 -0
- package/scripts/check_page_content.js +36 -0
- package/scripts/click_applause_rate.js +30 -0
- package/scripts/copy-native.js +36 -0
- package/scripts/copy-recorder.js +21 -0
- package/scripts/e2e-test-recorder.ts +584 -0
- package/scripts/explore_jd_page.js +31 -0
- package/scripts/extract_all_jd_data.js +80 -0
- package/scripts/extract_jd_product_detail.js +62 -0
- package/scripts/extract_jd_products_correct_links.js +78 -0
- package/scripts/extract_jd_products_final.js +80 -0
- package/scripts/extract_jd_reviews.js +48 -0
- package/scripts/extract_jd_seafood_final.js +78 -0
- package/scripts/extract_multiple_products.js +77 -0
- package/scripts/extract_products_no_scroll.js +68 -0
- package/scripts/extract_products_simple.js +68 -0
- package/scripts/find_applause_rate.js +26 -0
- package/scripts/find_jd_links.js +28 -0
- package/scripts/find_main_content.js +20 -0
- package/scripts/find_product_cards.js +38 -0
- package/scripts/find_root_content.js +26 -0
- package/scripts/find_unique_products.js +55 -0
- package/scripts/get_jd_product_detail.js +16 -0
- package/scripts/get_jd_products.js +23 -0
- package/scripts/get_jd_seafood_products.js +44 -0
- package/scripts/get_product_details_from_images.js +54 -0
- package/scripts/postinstall.js +235 -0
- package/scripts/scroll_and_get_products.js +47 -0
- package/scripts/scroll_deep_and_find.js +45 -0
- package/scripts/sync-version.js +69 -0
- package/scripts/verify-baidu-enter.ts +116 -0
- package/skills/agent-browser/SKILL.md +310 -0
- package/skills/agent-browser/references/authentication.md +198 -0
- package/skills/agent-browser/references/commands.md +471 -0
- package/skills/agent-browser/references/data-extraction.md +377 -0
- package/skills/agent-browser/references/proxy-support.md +188 -0
- package/skills/agent-browser/references/session-management.md +197 -0
- package/skills/agent-browser/references/snapshot-refs.md +379 -0
- package/skills/agent-browser/references/video-recording.md +173 -0
- package/skills/agent-browser/templates/api-interception.sh +53 -0
- package/skills/agent-browser/templates/authenticated-session.sh +97 -0
- package/skills/agent-browser/templates/capture-workflow.sh +69 -0
- package/skills/agent-browser/templates/data-extraction.sh +210 -0
- package/skills/agent-browser/templates/form-automation.sh +62 -0
- package/skills/skill-creator/LICENSE.txt +202 -0
- package/skills/skill-creator/SKILL.md +356 -0
- package/skills/skill-creator/references/output-patterns.md +82 -0
- package/skills/skill-creator/references/workflows.md +28 -0
- package/skills/skill-creator/scripts/init_skill.py +303 -0
- package/skills/skill-creator/scripts/package_skill.py +113 -0
- package/skills/skill-creator/scripts/quick_validate.py +95 -0
|
@@ -0,0 +1,471 @@
|
|
|
1
|
+
# Command Reference
|
|
2
|
+
|
|
3
|
+
Complete reference for all agent-browser commands. For quick start and common patterns, see SKILL.md.
|
|
4
|
+
|
|
5
|
+
## Navigation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
agent-browser open <url> # Navigate to URL (aliases: goto, navigate)
|
|
9
|
+
# Supports: https://, http://, file://, about:, data://
|
|
10
|
+
# Auto-prepends https:// if no protocol given
|
|
11
|
+
agent-browser back # Go back
|
|
12
|
+
agent-browser forward # Go forward
|
|
13
|
+
agent-browser reload # Reload page
|
|
14
|
+
agent-browser close # Close browser (aliases: quit, exit)
|
|
15
|
+
agent-browser connect 9222 # Connect to browser via CDP port
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Snapshot (page analysis)
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
agent-browser snapshot # Full accessibility tree
|
|
22
|
+
agent-browser snapshot -i # Interactive elements only (recommended)
|
|
23
|
+
agent-browser snapshot -c # Compact output
|
|
24
|
+
agent-browser snapshot -d 3 # Limit depth to 3
|
|
25
|
+
agent-browser snapshot -s "#main" # Scope to CSS selector
|
|
26
|
+
agent-browser snapshot -s "body" --path # Include xpath and cssPath in refs
|
|
27
|
+
agent-browser snapshot -s "body" --attrs # Include element attributes in refs
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
### Path and Attributes Options
|
|
31
|
+
|
|
32
|
+
When you need element paths or attributes, use `--path` and `--attrs`:
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
# Get xpath and cssPath for elements (can use without --selector)
|
|
36
|
+
agent-browser snapshot --path
|
|
37
|
+
agent-browser snapshot -s "body" --path
|
|
38
|
+
|
|
39
|
+
# Get element attributes (id, class, href, etc.)
|
|
40
|
+
agent-browser snapshot --attrs
|
|
41
|
+
agent-browser snapshot -s "body" --attrs
|
|
42
|
+
|
|
43
|
+
# Get both
|
|
44
|
+
agent-browser snapshot --path --attrs
|
|
45
|
+
agent-browser snapshot -s "body" --path --attrs
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
**Note:** Using `--selector` is optional but recommended to limit scope and prevent large responses.
|
|
49
|
+
|
|
50
|
+
**Response example with --path --attrs:**
|
|
51
|
+
```json
|
|
52
|
+
{
|
|
53
|
+
"refs": {
|
|
54
|
+
"e1": {
|
|
55
|
+
"role": "button",
|
|
56
|
+
"name": "Submit",
|
|
57
|
+
"xpath": "//*[@id=\"submit-btn\"]",
|
|
58
|
+
"cssPath": "#submit-btn",
|
|
59
|
+
"attributes": {"id": "submit-btn", "class": "btn-primary", "type": "submit"}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
## Interactions (use @refs from snapshot)
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
agent-browser click @e1 # Click
|
|
69
|
+
agent-browser dblclick @e1 # Double-click
|
|
70
|
+
agent-browser focus @e1 # Focus element
|
|
71
|
+
agent-browser fill @e2 "text" # Clear and type
|
|
72
|
+
agent-browser type @e2 "text" # Type without clearing
|
|
73
|
+
agent-browser press Enter # Press key (alias: key)
|
|
74
|
+
agent-browser press Control+a # Key combination
|
|
75
|
+
agent-browser keydown Shift # Hold key down
|
|
76
|
+
agent-browser keyup Shift # Release key
|
|
77
|
+
agent-browser hover @e1 # Hover
|
|
78
|
+
agent-browser check @e1 # Check checkbox
|
|
79
|
+
agent-browser uncheck @e1 # Uncheck checkbox
|
|
80
|
+
agent-browser select @e1 "value" # Select dropdown option
|
|
81
|
+
agent-browser select @e1 "a" "b" # Select multiple options
|
|
82
|
+
agent-browser scroll down 500 # Scroll page (default: down 300px)
|
|
83
|
+
agent-browser scrollintoview @e1 # Scroll element into view (alias: scrollinto)
|
|
84
|
+
agent-browser drag @e1 @e2 # Drag and drop
|
|
85
|
+
agent-browser upload @e1 file.pdf # Upload files
|
|
86
|
+
agent-browser download @e1 ./file.pdf # Download file by clicking element
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
### Human-like Mouse Movement
|
|
90
|
+
|
|
91
|
+
Enable globally via environment variable to simulate natural mouse trajectories:
|
|
92
|
+
|
|
93
|
+
```bash
|
|
94
|
+
# Enable human mode (default: arc path type)
|
|
95
|
+
export AGENT_BROWSER_HUMAN=1
|
|
96
|
+
|
|
97
|
+
# Or specify path type
|
|
98
|
+
export AGENT_BROWSER_HUMAN=bezier # Bezier curve with overshoot
|
|
99
|
+
export AGENT_BROWSER_HUMAN=arc # Smooth arc (default, most natural)
|
|
100
|
+
export AGENT_BROWSER_HUMAN=random # Random path with jitter
|
|
101
|
+
export AGENT_BROWSER_HUMAN=linear # Straight line (fastest)
|
|
102
|
+
|
|
103
|
+
# All interactions will use human-like movement
|
|
104
|
+
agent-browser click @e1
|
|
105
|
+
agent-browser fill @e1 "text"
|
|
106
|
+
agent-browser type @e1 "text"
|
|
107
|
+
agent-browser hover @e1
|
|
108
|
+
agent-browser dblclick @e1
|
|
109
|
+
|
|
110
|
+
# Wait with mouse wandering (when human mode enabled)
|
|
111
|
+
agent-browser wait 3000 # Wanders mouse while waiting
|
|
112
|
+
|
|
113
|
+
# Disable human mode
|
|
114
|
+
unset AGENT_BROWSER_HUMAN
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
**Trajectory Types:**
|
|
118
|
+
| Type | Description | Best For |
|
|
119
|
+
|------|-------------|----------|
|
|
120
|
+
| `arc` | Smooth arc trajectory (default) | Most natural, general use |
|
|
121
|
+
| `bezier` | Bezier curve with overshoot | Realistic targeting |
|
|
122
|
+
| `random` | Random path with jitter | Maximum unpredictability |
|
|
123
|
+
| `linear` | Straight line | Fastest, less detection needed |
|
|
124
|
+
|
|
125
|
+
**Affected Commands:**
|
|
126
|
+
| Command | Human Mode Effect |
|
|
127
|
+
|---------|-------------------|
|
|
128
|
+
| `click` | Human-like mouse trajectory + click |
|
|
129
|
+
| `dblclick` | Human-like mouse trajectory + double-click |
|
|
130
|
+
| `fill` | Human-like mouse trajectory + character-by-character typing |
|
|
131
|
+
| `type` | Human-like mouse trajectory + character-by-character typing |
|
|
132
|
+
| `hover` | Human-like mouse trajectory |
|
|
133
|
+
| `wait <ms>` | Random mouse wandering while waiting |
|
|
134
|
+
|
|
135
|
+
## Get Information
|
|
136
|
+
|
|
137
|
+
```bash
|
|
138
|
+
agent-browser get text @e1 # Get element text
|
|
139
|
+
agent-browser get html @e1 # Get innerHTML
|
|
140
|
+
agent-browser get value @e1 # Get input value
|
|
141
|
+
agent-browser get attr @e1 href # Get attribute
|
|
142
|
+
agent-browser get title # Get page title
|
|
143
|
+
agent-browser get url # Get current URL
|
|
144
|
+
agent-browser get count ".item" # Count matching elements
|
|
145
|
+
agent-browser get box @e1 # Get bounding box
|
|
146
|
+
agent-browser get styles @e1 # Get computed styles (font, color, bg, etc.)
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
## Check State
|
|
150
|
+
|
|
151
|
+
```bash
|
|
152
|
+
agent-browser is visible @e1 # Check if visible
|
|
153
|
+
agent-browser is enabled @e1 # Check if enabled
|
|
154
|
+
agent-browser is checked @e1 # Check if checked
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
## Screenshots and PDF
|
|
158
|
+
|
|
159
|
+
```bash
|
|
160
|
+
agent-browser screenshot # Save to temporary directory
|
|
161
|
+
agent-browser screenshot path.png # Save to specific path
|
|
162
|
+
agent-browser screenshot --full # Full page
|
|
163
|
+
agent-browser pdf output.pdf # Save as PDF
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
## Video Recording
|
|
167
|
+
|
|
168
|
+
```bash
|
|
169
|
+
agent-browser record start ./demo.webm # Start recording
|
|
170
|
+
agent-browser click @e1 # Perform actions
|
|
171
|
+
agent-browser record stop # Stop and save video
|
|
172
|
+
agent-browser record restart ./take2.webm # Stop current + start new
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
## Wait
|
|
176
|
+
|
|
177
|
+
```bash
|
|
178
|
+
agent-browser wait @e1 # Wait for element
|
|
179
|
+
agent-browser wait 2000 # Wait milliseconds
|
|
180
|
+
agent-browser wait --text "Success" # Wait for text (or -t)
|
|
181
|
+
agent-browser wait --url "**/dashboard" # Wait for URL pattern (or -u)
|
|
182
|
+
agent-browser wait --load networkidle # Wait for network idle (or -l)
|
|
183
|
+
agent-browser wait --fn "window.ready" # Wait for JS condition (or -f)
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
## Mouse Control
|
|
187
|
+
|
|
188
|
+
```bash
|
|
189
|
+
agent-browser mouse move 100 200 # Move mouse
|
|
190
|
+
agent-browser mouse down left # Press button
|
|
191
|
+
agent-browser mouse up left # Release button
|
|
192
|
+
agent-browser mouse wheel 100 # Scroll wheel
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
## Semantic Locators (alternative to refs)
|
|
196
|
+
|
|
197
|
+
```bash
|
|
198
|
+
agent-browser find role button click --name "Submit"
|
|
199
|
+
agent-browser find text "Sign In" click
|
|
200
|
+
agent-browser find text "Sign In" click --exact # Exact match only
|
|
201
|
+
agent-browser find label "Email" fill "user@test.com"
|
|
202
|
+
agent-browser find placeholder "Search" type "query"
|
|
203
|
+
agent-browser find alt "Logo" click
|
|
204
|
+
agent-browser find title "Close" click
|
|
205
|
+
agent-browser find testid "submit-btn" click
|
|
206
|
+
agent-browser find first ".item" click
|
|
207
|
+
agent-browser find last ".item" click
|
|
208
|
+
agent-browser find nth 2 "a" hover
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
**Important:** `first`, `last`, `nth` are locators for the `find` command, NOT CSS selectors. Do NOT use them directly with `click`, `fill`, etc.
|
|
212
|
+
|
|
213
|
+
```bash
|
|
214
|
+
# WRONG - "first" is not a CSS selector
|
|
215
|
+
agent-browser click "first .item" # Will fail!
|
|
216
|
+
|
|
217
|
+
# CORRECT - Use find command with first locator
|
|
218
|
+
agent-browser find first ".item" click
|
|
219
|
+
|
|
220
|
+
# ALTERNATIVE - Use CSS pseudo-class selectors
|
|
221
|
+
agent-browser click ".item:first-of-type"
|
|
222
|
+
agent-browser click ".item:last-of-type"
|
|
223
|
+
agent-browser click ".item:nth-of-type(2)"
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
## Browser Settings
|
|
227
|
+
|
|
228
|
+
```bash
|
|
229
|
+
agent-browser set viewport 1920 1080 # Set viewport size
|
|
230
|
+
agent-browser set device "iPhone 14" # Emulate device
|
|
231
|
+
agent-browser set geo 37.7749 -122.4194 # Set geolocation (alias: geolocation)
|
|
232
|
+
agent-browser set offline on # Toggle offline mode
|
|
233
|
+
agent-browser set headers '{"X-Key":"v"}' # Extra HTTP headers
|
|
234
|
+
agent-browser set credentials user pass # HTTP basic auth (alias: auth)
|
|
235
|
+
agent-browser set media dark # Emulate color scheme
|
|
236
|
+
agent-browser set media light reduced-motion # Light mode + reduced motion
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
## Cookies and Storage
|
|
240
|
+
|
|
241
|
+
```bash
|
|
242
|
+
agent-browser cookies # Get all cookies
|
|
243
|
+
agent-browser cookies set name value # Set cookie
|
|
244
|
+
agent-browser cookies clear # Clear cookies
|
|
245
|
+
agent-browser storage local # Get all localStorage
|
|
246
|
+
agent-browser storage local key # Get specific key
|
|
247
|
+
agent-browser storage local set k v # Set value
|
|
248
|
+
agent-browser storage local clear # Clear all
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
## Network
|
|
252
|
+
|
|
253
|
+
```bash
|
|
254
|
+
agent-browser network route <url> # Intercept requests
|
|
255
|
+
agent-browser network route <url> --abort # Block requests
|
|
256
|
+
agent-browser network route <url> --body '{}' # Mock response
|
|
257
|
+
agent-browser network unroute [url] # Remove routes
|
|
258
|
+
agent-browser network requests # View tracked requests
|
|
259
|
+
agent-browser network requests --filter api # Filter requests
|
|
260
|
+
|
|
261
|
+
# Wait for API request and capture response
|
|
262
|
+
agent-browser wait --request "api/users" # Wait for matching request
|
|
263
|
+
agent-browser wait --request "aweme/post" --timeout 30000 # With timeout
|
|
264
|
+
```
|
|
265
|
+
|
|
266
|
+
## Tabs
|
|
267
|
+
|
|
268
|
+
```bash
|
|
269
|
+
agent-browser tab # List tabs
|
|
270
|
+
agent-browser tab new [url] # New tab
|
|
271
|
+
agent-browser tab 2 # Switch to tab by index
|
|
272
|
+
agent-browser tab close # Close current tab
|
|
273
|
+
agent-browser tab close 2 # Close tab by index
|
|
274
|
+
```
|
|
275
|
+
|
|
276
|
+
Note: `window new` command exists but creates a new browser window context.
|
|
277
|
+
|
|
278
|
+
## Iframes (--in-frame option)
|
|
279
|
+
|
|
280
|
+
Use `--in-frame` option to operate inside iframes. There is no separate `frame` command.
|
|
281
|
+
|
|
282
|
+
```bash
|
|
283
|
+
# Single iframe by ID or name
|
|
284
|
+
agent-browser snapshot --in-frame "#my-iframe"
|
|
285
|
+
agent-browser click @e1 --in-frame "#login-frame"
|
|
286
|
+
agent-browser fill #username "admin" --in-frame "#my-frame"
|
|
287
|
+
|
|
288
|
+
# Nested iframes using path
|
|
289
|
+
agent-browser snapshot --in-frame "#outer-iframe/inner-iframe"
|
|
290
|
+
agent-browser get value #input --in-frame "#parent/child"
|
|
291
|
+
|
|
292
|
+
# Using index instead of name
|
|
293
|
+
agent-browser snapshot --in-frame "#0"
|
|
294
|
+
agent-browser snapshot --in-frame "#0/1" # First iframe's second child
|
|
295
|
+
```
|
|
296
|
+
|
|
297
|
+
### Frame Path Syntax
|
|
298
|
+
|
|
299
|
+
| Format | Example | Description |
|
|
300
|
+
|--------|---------|-------------|
|
|
301
|
+
| `#id` | `#my-frame` | Frame by ID attribute |
|
|
302
|
+
| `#name` | `#login-form` | Frame by name attribute |
|
|
303
|
+
| `#index` | `#0`, `#1` | Frame by position |
|
|
304
|
+
| `#path` | `#parent/child` | Nested frame by path |
|
|
305
|
+
| `#mixed` | `#0/login-form` | Mix of index and name |
|
|
306
|
+
|
|
307
|
+
The `--in-frame` option works with: click, dblclick, hover, focus, fill, type, check, uncheck, select, scrollintoview, drag, upload, download, press, wait, get, is, find, mouse, eval, snapshot, pdf, highlight, and more.
|
|
308
|
+
|
|
309
|
+
## Dialogs
|
|
310
|
+
|
|
311
|
+
```bash
|
|
312
|
+
agent-browser dialog accept [text] # Accept dialog
|
|
313
|
+
agent-browser dialog dismiss # Dismiss dialog
|
|
314
|
+
```
|
|
315
|
+
|
|
316
|
+
## JavaScript
|
|
317
|
+
|
|
318
|
+
```bash
|
|
319
|
+
agent-browser eval "document.title" # Simple expressions only
|
|
320
|
+
agent-browser eval -b "<base64>" # Any JavaScript (base64 encoded)
|
|
321
|
+
agent-browser eval --stdin # Read script from stdin
|
|
322
|
+
```
|
|
323
|
+
|
|
324
|
+
Use `-b`/`--base64` or `--stdin` for reliable execution. Shell escaping with nested quotes and special characters is error-prone.
|
|
325
|
+
|
|
326
|
+
```bash
|
|
327
|
+
# Base64 encode your script, then:
|
|
328
|
+
agent-browser eval -b "ZG9jdW1lbnQucXVlcnlTZWxlY3RvcignW3NyYyo9Il9uZXh0Il0nKQ=="
|
|
329
|
+
|
|
330
|
+
# Or use stdin with heredoc for multiline scripts:
|
|
331
|
+
cat <<'EOF' | agent-browser eval --stdin
|
|
332
|
+
const links = document.querySelectorAll('a');
|
|
333
|
+
Array.from(links).map(a => a.href);
|
|
334
|
+
EOF
|
|
335
|
+
```
|
|
336
|
+
|
|
337
|
+
## State Management
|
|
338
|
+
|
|
339
|
+
```bash
|
|
340
|
+
agent-browser state save auth.json # Save cookies, storage, auth state
|
|
341
|
+
agent-browser state load auth.json # Set state path (loads at browser launch)
|
|
342
|
+
```
|
|
343
|
+
|
|
344
|
+
**Note:** State must be loaded at browser launch. Use `--state` flag or close browser first:
|
|
345
|
+
|
|
346
|
+
```bash
|
|
347
|
+
# Method 1: Use --state flag at launch
|
|
348
|
+
agent-browser --state auth.json open https://app.example.com
|
|
349
|
+
|
|
350
|
+
# Method 2: Set path, close, then launch
|
|
351
|
+
agent-browser state load auth.json
|
|
352
|
+
agent-browser close
|
|
353
|
+
agent-browser open https://app.example.com
|
|
354
|
+
```
|
|
355
|
+
|
|
356
|
+
## Global Options
|
|
357
|
+
|
|
358
|
+
```bash
|
|
359
|
+
agent-browser --session <name> ... # Isolated browser session
|
|
360
|
+
agent-browser --json ... # JSON output for parsing
|
|
361
|
+
agent-browser --headed ... # Show browser window (not headless)
|
|
362
|
+
agent-browser --full ... # Full page screenshot (-f)
|
|
363
|
+
agent-browser --cdp <port> ... # Connect via Chrome DevTools Protocol
|
|
364
|
+
agent-browser -p <provider> ... # Cloud browser provider (--provider)
|
|
365
|
+
agent-browser --proxy <url> ... # Use proxy server
|
|
366
|
+
agent-browser --headers <json> ... # HTTP headers scoped to URL's origin
|
|
367
|
+
agent-browser --executable-path <p> # Custom browser executable
|
|
368
|
+
agent-browser --extension <path> ... # Load browser extension (repeatable)
|
|
369
|
+
agent-browser --ignore-https-errors # Ignore SSL certificate errors
|
|
370
|
+
agent-browser --help # Show help (-h)
|
|
371
|
+
agent-browser --version # Show version (-V)
|
|
372
|
+
agent-browser <command> --help # Show detailed help for a command
|
|
373
|
+
```
|
|
374
|
+
|
|
375
|
+
## Debugging
|
|
376
|
+
|
|
377
|
+
```bash
|
|
378
|
+
agent-browser --headed open example.com # Show browser window
|
|
379
|
+
agent-browser --cdp 9222 snapshot # Connect via CDP port
|
|
380
|
+
agent-browser connect 9222 # Alternative: connect command
|
|
381
|
+
agent-browser console # View console messages
|
|
382
|
+
agent-browser console --clear # Clear console
|
|
383
|
+
agent-browser errors # View page errors
|
|
384
|
+
agent-browser errors --clear # Clear errors
|
|
385
|
+
agent-browser highlight @e1 # Highlight element
|
|
386
|
+
agent-browser trace start # Start recording trace
|
|
387
|
+
agent-browser trace stop trace.zip # Stop and save trace
|
|
388
|
+
```
|
|
389
|
+
|
|
390
|
+
## Step Recorder
|
|
391
|
+
|
|
392
|
+
Record user interactions as structured steps for LLM processing:
|
|
393
|
+
|
|
394
|
+
```bash
|
|
395
|
+
agent-browser recorder start # Start recording
|
|
396
|
+
agent-browser recorder start https://site.com # Start with navigation
|
|
397
|
+
agent-browser recorder stop # Stop and output YAML
|
|
398
|
+
agent-browser recorder stop --output session.yaml # Save to file
|
|
399
|
+
agent-browser recorder status # Show recording status
|
|
400
|
+
agent-browser recorder replay # Replay most recent
|
|
401
|
+
agent-browser recorder replay session.yaml # Replay specific file
|
|
402
|
+
```
|
|
403
|
+
|
|
404
|
+
## Remote Viewing
|
|
405
|
+
|
|
406
|
+
```bash
|
|
407
|
+
agent-browser viewer # Get viewer URL for browser session
|
|
408
|
+
agent-browser viewer --json # Get all URLs (HTTP + WebSocket)
|
|
409
|
+
```
|
|
410
|
+
|
|
411
|
+
Requires Stream Server to be running.
|
|
412
|
+
|
|
413
|
+
## User Interaction
|
|
414
|
+
|
|
415
|
+
```bash
|
|
416
|
+
# Simple question
|
|
417
|
+
agent-browser ask "What should I do next?"
|
|
418
|
+
|
|
419
|
+
# Multiple choice question (JSON format)
|
|
420
|
+
agent-browser ask '{"questions":[{"question":"Choose action","options":[{"label":"Login"},{"label":"Skip"}]}]}'
|
|
421
|
+
|
|
422
|
+
# Multi-select question
|
|
423
|
+
agent-browser ask '{"questions":[{"question":"Select items","multiSelect":true,"options":[{"label":"Item 1"},{"label":"Item 2"}]}]}'
|
|
424
|
+
```
|
|
425
|
+
|
|
426
|
+
Requires Stream Server with message bridge.
|
|
427
|
+
|
|
428
|
+
## Session Management
|
|
429
|
+
|
|
430
|
+
```bash
|
|
431
|
+
agent-browser session # Show current session name
|
|
432
|
+
agent-browser session list # List all active sessions
|
|
433
|
+
agent-browser kill # Kill all daemons and Stream Server
|
|
434
|
+
```
|
|
435
|
+
|
|
436
|
+
## Configuration
|
|
437
|
+
|
|
438
|
+
```bash
|
|
439
|
+
agent-browser config # Show all AGENT_BROWSER_* settings
|
|
440
|
+
agent-browser config --json # JSON output
|
|
441
|
+
```
|
|
442
|
+
|
|
443
|
+
## Setup
|
|
444
|
+
|
|
445
|
+
```bash
|
|
446
|
+
agent-browser install # Install browser binaries
|
|
447
|
+
agent-browser install --with-deps # Also install system dependencies (Linux)
|
|
448
|
+
```
|
|
449
|
+
|
|
450
|
+
## Diff Option (Page Change Detection)
|
|
451
|
+
|
|
452
|
+
Show page changes after actions:
|
|
453
|
+
|
|
454
|
+
```bash
|
|
455
|
+
agent-browser click @e1 --diff # Show changes 3 levels up from target
|
|
456
|
+
agent-browser fill @e2 "text" --diff 5 # Show changes 5 levels up
|
|
457
|
+
agent-browser click @e1 --diff full # Show entire page changes
|
|
458
|
+
agent-browser click @e1 --diff --selector "#content" # Scope to selector
|
|
459
|
+
```
|
|
460
|
+
|
|
461
|
+
## Environment Variables
|
|
462
|
+
|
|
463
|
+
```bash
|
|
464
|
+
AGENT_BROWSER_SESSION="mysession" # Default session name
|
|
465
|
+
AGENT_BROWSER_EXECUTABLE_PATH="/path/chrome" # Custom browser path
|
|
466
|
+
AGENT_BROWSER_EXTENSIONS="/ext1,/ext2" # Comma-separated extension paths
|
|
467
|
+
AGENT_BROWSER_PROVIDER="browserbase" # Cloud browser provider
|
|
468
|
+
AGENT_BROWSER_STREAM_PORT="9223" # WebSocket streaming port
|
|
469
|
+
AGENT_BROWSER_HOME="/path/to/agent-browser" # Custom install location
|
|
470
|
+
AGENT_BROWSER_HUMAN="1" # Enable human-like mouse movement (1, bezier, arc, random, linear)
|
|
471
|
+
```
|