cbrowser 17.6.0 → 18.0.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/dist/browser.d.ts +4 -0
- package/dist/browser.d.ts.map +1 -1
- package/dist/browser.js +37 -1
- package/dist/browser.js.map +1 -1
- package/dist/cli.js +10 -5
- package/dist/cli.js.map +1 -1
- package/dist/mcp-server-remote.d.ts.map +1 -1
- package/dist/mcp-server-remote.js +16 -0
- package/dist/mcp-server-remote.js.map +1 -1
- package/docs/Tool-Cognitive-Journey-Autonomous.md +264 -0
- package/docs/Tool-Competitive-Benchmark.md +287 -0
- package/docs/Tool-Empathy-Audit.md +325 -0
- package/docs/Tool-Hunt-Bugs.md +299 -0
- package/docs/Tool-Marketing-Campaign.md +292 -0
- package/docs/Tool-Persona-Create.md +268 -0
- package/docs/Tools-Accessibility.md +202 -0
- package/docs/Tools-Browser-Automation.md +305 -0
- package/docs/Tools-Cognitive-Journeys.md +227 -0
- package/docs/Tools-Marketing-Intelligence.md +265 -0
- package/docs/Tools-Overview.md +143 -0
- package/docs/Tools-Persona-System.md +294 -0
- package/docs/Tools-Session-State.md +272 -0
- package/docs/Tools-Testing-Quality.md +251 -0
- package/docs/Tools-Utilities.md +176 -0
- package/docs/Tools-Visual-Performance.md +272 -0
- package/package.json +1 -1
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
# Accessibility Tools
|
|
2
|
+
|
|
3
|
+
**Experience your site through the eyes of someone who can't use a mouse.**
|
|
4
|
+
|
|
5
|
+
The `empathy_audit` tool simulates how people with disabilities actually experience your site — motor tremors that make clicking hard, low vision that requires zoom, ADHD that makes long forms impossible. This isn't a WCAG checklist. It's lived experience simulation.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## When to Use This Tool
|
|
10
|
+
|
|
11
|
+
- **You think your site is accessible** but you've only run automated checkers
|
|
12
|
+
- **You need to prioritize fixes** and want to know what actually impacts real users
|
|
13
|
+
- **You're building for an aging population** and need to understand their struggles
|
|
14
|
+
- **Compliance audits are coming** and you need to find issues before auditors do
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
## The Tool
|
|
19
|
+
|
|
20
|
+
### `empathy_audit`
|
|
21
|
+
|
|
22
|
+
**What it does**: Simulate disability personas navigating your site, detecting WCAG violations with the context of how they actually impact users.
|
|
23
|
+
|
|
24
|
+
**Why you'd use it**: Automated accessibility checkers find violations. This tool shows you which violations actually matter and what the experience feels like.
|
|
25
|
+
|
|
26
|
+
| Parameter | Type | Required | Description |
|
|
27
|
+
|-----------|------|----------|-------------|
|
|
28
|
+
| `url` | string | Yes | URL to audit |
|
|
29
|
+
| `personas` | array | No | Disability personas to simulate. Default: all |
|
|
30
|
+
| `task` | string | No | Specific task to attempt (e.g., "complete checkout") |
|
|
31
|
+
| `wcagLevel` | string | No | WCAG level: `A`, `AA`, `AAA`. Default: `AA` |
|
|
32
|
+
|
|
33
|
+
**Example**:
|
|
34
|
+
```json
|
|
35
|
+
{
|
|
36
|
+
"url": "https://example.com/signup",
|
|
37
|
+
"personas": ["motor-tremor", "low-vision", "cognitive-adhd"],
|
|
38
|
+
"task": "Create an account"
|
|
39
|
+
}
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
---
|
|
43
|
+
|
|
44
|
+
## Disability Personas
|
|
45
|
+
|
|
46
|
+
### `motor-tremor`
|
|
47
|
+
|
|
48
|
+
**Simulates**: Essential tremor, Parkinson's disease, or any condition affecting fine motor control.
|
|
49
|
+
|
|
50
|
+
**Behavioral Impact**:
|
|
51
|
+
- Struggles with small click targets (< 44px)
|
|
52
|
+
- Can't hover reliably for dropdown menus
|
|
53
|
+
- Needs keyboard navigation
|
|
54
|
+
- Frustrated by time-limited interactions
|
|
55
|
+
|
|
56
|
+
**WCAG Focus**: Target size (2.5.5), Keyboard accessible (2.1.1), No timing (2.2.3)
|
|
57
|
+
|
|
58
|
+
---
|
|
59
|
+
|
|
60
|
+
### `low-vision`
|
|
61
|
+
|
|
62
|
+
**Simulates**: Partial sight, macular degeneration, or conditions requiring magnification.
|
|
63
|
+
|
|
64
|
+
**Behavioral Impact**:
|
|
65
|
+
- Uses 200%+ zoom
|
|
66
|
+
- Loses context when zoomed in
|
|
67
|
+
- Needs high contrast
|
|
68
|
+
- Can't see small text or icons without labels
|
|
69
|
+
|
|
70
|
+
**WCAG Focus**: Reflow (1.4.10), Contrast (1.4.3), Text spacing (1.4.12)
|
|
71
|
+
|
|
72
|
+
---
|
|
73
|
+
|
|
74
|
+
### `cognitive-adhd`
|
|
75
|
+
|
|
76
|
+
**Simulates**: ADHD, attention difficulties, executive function challenges.
|
|
77
|
+
|
|
78
|
+
**Behavioral Impact**:
|
|
79
|
+
- Skims rapidly, misses key information
|
|
80
|
+
- Abandons long forms
|
|
81
|
+
- Distracted by animations/movement
|
|
82
|
+
- Needs clear visual hierarchy
|
|
83
|
+
|
|
84
|
+
**WCAG Focus**: Pause/stop (2.2.2), Error prevention (3.3.4), Consistent navigation (3.2.3)
|
|
85
|
+
|
|
86
|
+
---
|
|
87
|
+
|
|
88
|
+
### `dyslexia`
|
|
89
|
+
|
|
90
|
+
**Simulates**: Reading difficulties, letter/word recognition challenges.
|
|
91
|
+
|
|
92
|
+
**Behavioral Impact**:
|
|
93
|
+
- Struggles with dense text blocks
|
|
94
|
+
- Needs clear typography and spacing
|
|
95
|
+
- Misreads similar words
|
|
96
|
+
- Benefits from icons alongside text
|
|
97
|
+
|
|
98
|
+
**WCAG Focus**: Reading level (3.1.5), Line height (1.4.12), Clear fonts
|
|
99
|
+
|
|
100
|
+
---
|
|
101
|
+
|
|
102
|
+
### `deaf`
|
|
103
|
+
|
|
104
|
+
**Simulates**: Deaf or hard of hearing users.
|
|
105
|
+
|
|
106
|
+
**Behavioral Impact**:
|
|
107
|
+
- Can't access audio content without captions
|
|
108
|
+
- Misses audio alerts/notifications
|
|
109
|
+
- Relies entirely on visual information
|
|
110
|
+
- Needs sign language or text alternatives
|
|
111
|
+
|
|
112
|
+
**WCAG Focus**: Captions (1.2.2), Audio description (1.2.5), Visual alternatives (1.4.1)
|
|
113
|
+
|
|
114
|
+
---
|
|
115
|
+
|
|
116
|
+
### `color-blind`
|
|
117
|
+
|
|
118
|
+
**Simulates**: Color vision deficiency (protanopia, deuteranopia, tritanopia).
|
|
119
|
+
|
|
120
|
+
**Behavioral Impact**:
|
|
121
|
+
- Can't distinguish red/green, blue/yellow
|
|
122
|
+
- Misses color-coded information
|
|
123
|
+
- Needs patterns/labels in addition to color
|
|
124
|
+
- Confused by red/green status indicators
|
|
125
|
+
|
|
126
|
+
**WCAG Focus**: Use of color (1.4.1), Contrast (1.4.3)
|
|
127
|
+
|
|
128
|
+
---
|
|
129
|
+
|
|
130
|
+
## What the Audit Returns
|
|
131
|
+
|
|
132
|
+
```json
|
|
133
|
+
{
|
|
134
|
+
"persona": "motor-tremor",
|
|
135
|
+
"taskSuccess": false,
|
|
136
|
+
"abandonmentPoint": "Payment form - credit card expiry dropdown",
|
|
137
|
+
"timeToAbandon": 142,
|
|
138
|
+
"barriers": [
|
|
139
|
+
{
|
|
140
|
+
"type": "small-target",
|
|
141
|
+
"element": "#expiry-month",
|
|
142
|
+
"wcag": "2.5.5",
|
|
143
|
+
"severity": "critical",
|
|
144
|
+
"userImpact": "Cannot reliably click the 32px dropdown with tremor",
|
|
145
|
+
"remediation": "Increase target size to 44px minimum or provide keyboard alternative"
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
"type": "hover-dependent",
|
|
149
|
+
"element": ".nav-dropdown",
|
|
150
|
+
"wcag": "2.1.1",
|
|
151
|
+
"severity": "serious",
|
|
152
|
+
"userImpact": "Dropdown closes before user can move cursor into it",
|
|
153
|
+
"remediation": "Add click-to-open or increase hover delay"
|
|
154
|
+
}
|
|
155
|
+
],
|
|
156
|
+
"wcagViolations": 7,
|
|
157
|
+
"recommendations": [
|
|
158
|
+
"Add keyboard navigation to all dropdowns",
|
|
159
|
+
"Increase minimum touch target to 44px",
|
|
160
|
+
"Add skip-to-content link"
|
|
161
|
+
]
|
|
162
|
+
}
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
---
|
|
166
|
+
|
|
167
|
+
## Why This Is Different From WCAG Checkers
|
|
168
|
+
|
|
169
|
+
| Traditional Checker | Empathy Audit |
|
|
170
|
+
|--------------------|---------------|
|
|
171
|
+
| "Image missing alt text" | "Blind user couldn't understand the product because the hero image has no description" |
|
|
172
|
+
| "Target size 32px" | "User with tremor couldn't click the dropdown after 8 attempts" |
|
|
173
|
+
| "Contrast ratio 3.8:1" | "Low vision user at 200% zoom couldn't read the error message" |
|
|
174
|
+
| Reports violations | Reports **impact** |
|
|
175
|
+
| Pass/fail metrics | Abandonment stories |
|
|
176
|
+
|
|
177
|
+
---
|
|
178
|
+
|
|
179
|
+
## Running Empathy Audits in CI/CD
|
|
180
|
+
|
|
181
|
+
```bash
|
|
182
|
+
# Quick audit before deploy
|
|
183
|
+
npx cbrowser empathy-audit https://staging.example.com --personas motor-tremor,low-vision
|
|
184
|
+
|
|
185
|
+
# Full audit with task
|
|
186
|
+
npx cbrowser empathy-audit https://staging.example.com \
|
|
187
|
+
--task "Complete checkout" \
|
|
188
|
+
--wcag AA \
|
|
189
|
+
--output report.html
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
---
|
|
193
|
+
|
|
194
|
+
## Related Documentation
|
|
195
|
+
|
|
196
|
+
- [Persona Index](/docs/Persona-Index/) — All personas including accessibility
|
|
197
|
+
- [UX Analysis Suite](/docs/UX-Analysis-Suite/) — Full UX analysis capabilities
|
|
198
|
+
- [Constitutional Safety](/docs/Constitutional-Safety/) — How CBrowser handles sensitive operations
|
|
199
|
+
|
|
200
|
+
---
|
|
201
|
+
|
|
202
|
+
*Last updated: v17.6.0*
|
|
@@ -0,0 +1,305 @@
|
|
|
1
|
+
# Browser Automation Tools
|
|
2
|
+
|
|
3
|
+
**Tell the browser what you want. Let AI figure out how.**
|
|
4
|
+
|
|
5
|
+
These 12 tools handle navigation, clicking, form filling, data extraction, and page analysis. They replace brittle CSS selectors with natural language descriptions that survive DOM changes.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## When to Use These Tools
|
|
10
|
+
|
|
11
|
+
- **You're automating a workflow** and tired of tests breaking when developers change class names
|
|
12
|
+
- **You need to extract data** from pages without writing custom scrapers for each site
|
|
13
|
+
- **You're building an AI agent** that needs to interact with arbitrary websites
|
|
14
|
+
- **Your selectors keep failing** and you want something that self-heals
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
## Tools
|
|
19
|
+
|
|
20
|
+
### `navigate`
|
|
21
|
+
|
|
22
|
+
**What it does**: Opens a URL and takes a screenshot of the loaded page.
|
|
23
|
+
|
|
24
|
+
**Why you'd use it**: Start any browser automation session or move between pages.
|
|
25
|
+
|
|
26
|
+
| Parameter | Type | Required | Description |
|
|
27
|
+
|-----------|------|----------|-------------|
|
|
28
|
+
| `url` | string | Yes | The URL to navigate to |
|
|
29
|
+
|
|
30
|
+
**Example**:
|
|
31
|
+
```json
|
|
32
|
+
{
|
|
33
|
+
"url": "https://example.com/products"
|
|
34
|
+
}
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
---
|
|
38
|
+
|
|
39
|
+
### `click`
|
|
40
|
+
|
|
41
|
+
**What it does**: Clicks an element using text content, CSS selector, or natural language description.
|
|
42
|
+
|
|
43
|
+
**Why you'd use it**: Interact with buttons, links, or any clickable element without fragile selectors.
|
|
44
|
+
|
|
45
|
+
| Parameter | Type | Required | Description |
|
|
46
|
+
|-----------|------|----------|-------------|
|
|
47
|
+
| `selector` | string | Yes | What to click — text, CSS selector, or description like "the blue submit button" |
|
|
48
|
+
| `force` | boolean | No | Bypass constitutional safety checks for destructive actions |
|
|
49
|
+
| `verbose` | boolean | No | Return available elements and AI suggestions on failure |
|
|
50
|
+
|
|
51
|
+
**Example**:
|
|
52
|
+
```json
|
|
53
|
+
{
|
|
54
|
+
"selector": "Add to Cart"
|
|
55
|
+
}
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
Or with natural language:
|
|
59
|
+
```json
|
|
60
|
+
{
|
|
61
|
+
"selector": "the primary call-to-action button in the hero section"
|
|
62
|
+
}
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
---
|
|
66
|
+
|
|
67
|
+
### `smart_click`
|
|
68
|
+
|
|
69
|
+
**What it does**: Clicks with automatic retry and self-healing selectors. If the original selector fails, it finds the element by intent.
|
|
70
|
+
|
|
71
|
+
**Why you'd use it**: When elements might not be immediately available or when you want resilience against DOM changes.
|
|
72
|
+
|
|
73
|
+
| Parameter | Type | Required | Description |
|
|
74
|
+
|-----------|------|----------|-------------|
|
|
75
|
+
| `selector` | string | Yes | Element to click |
|
|
76
|
+
| `maxRetries` | number | No | Maximum retry attempts. Default: 3 |
|
|
77
|
+
| `dismissOverlays` | boolean | No | Automatically dismiss popups before clicking. Default: false |
|
|
78
|
+
|
|
79
|
+
**Example**:
|
|
80
|
+
```json
|
|
81
|
+
{
|
|
82
|
+
"selector": "Submit Order",
|
|
83
|
+
"dismissOverlays": true
|
|
84
|
+
}
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
**Note**: v11.8.0 added confidence gating — only reports success if the healed selector has ≥60% confidence.
|
|
88
|
+
|
|
89
|
+
---
|
|
90
|
+
|
|
91
|
+
### `fill`
|
|
92
|
+
|
|
93
|
+
**What it does**: Types text into a form field identified by name, label, or description.
|
|
94
|
+
|
|
95
|
+
**Why you'd use it**: Fill out forms without knowing the exact input names or IDs.
|
|
96
|
+
|
|
97
|
+
| Parameter | Type | Required | Description |
|
|
98
|
+
|-----------|------|----------|-------------|
|
|
99
|
+
| `selector` | string | Yes | The field to fill — label text, name attribute, or description |
|
|
100
|
+
| `value` | string | Yes | Text to type into the field |
|
|
101
|
+
| `clear` | boolean | No | Clear existing content before typing. Default: true |
|
|
102
|
+
|
|
103
|
+
**Example**:
|
|
104
|
+
```json
|
|
105
|
+
{
|
|
106
|
+
"selector": "Email address",
|
|
107
|
+
"value": "user@example.com"
|
|
108
|
+
}
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
---
|
|
112
|
+
|
|
113
|
+
### `scroll`
|
|
114
|
+
|
|
115
|
+
**What it does**: Scrolls the page in a specified direction or to a specific position.
|
|
116
|
+
|
|
117
|
+
**Why you'd use it**: Reveal content below the fold, trigger lazy loading, or reach elements not yet visible.
|
|
118
|
+
|
|
119
|
+
| Parameter | Type | Required | Description |
|
|
120
|
+
|-----------|------|----------|-------------|
|
|
121
|
+
| `direction` | string | Yes | `up`, `down`, `top`, `bottom`, or pixel amount like `500px` |
|
|
122
|
+
|
|
123
|
+
**Example**:
|
|
124
|
+
```json
|
|
125
|
+
{
|
|
126
|
+
"direction": "down"
|
|
127
|
+
}
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
---
|
|
131
|
+
|
|
132
|
+
### `screenshot`
|
|
133
|
+
|
|
134
|
+
**What it does**: Captures the current page as an image.
|
|
135
|
+
|
|
136
|
+
**Why you'd use it**: Document state, debug failures, or feed visual information to AI.
|
|
137
|
+
|
|
138
|
+
| Parameter | Type | Required | Description |
|
|
139
|
+
|-----------|------|----------|-------------|
|
|
140
|
+
| `fullPage` | boolean | No | Capture entire scrollable page. Default: false (viewport only) |
|
|
141
|
+
| `path` | string | No | Save to file path instead of returning base64 |
|
|
142
|
+
|
|
143
|
+
**Example**:
|
|
144
|
+
```json
|
|
145
|
+
{
|
|
146
|
+
"fullPage": true
|
|
147
|
+
}
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
---
|
|
151
|
+
|
|
152
|
+
### `extract`
|
|
153
|
+
|
|
154
|
+
**What it does**: Pulls structured data from the page — links, headings, forms, images, or arbitrary text.
|
|
155
|
+
|
|
156
|
+
**Why you'd use it**: Scrape content, analyze page structure, or gather data for further processing.
|
|
157
|
+
|
|
158
|
+
| Parameter | Type | Required | Description |
|
|
159
|
+
|-----------|------|----------|-------------|
|
|
160
|
+
| `type` | string | Yes | What to extract: `links`, `headings`, `forms`, `images`, `text`, or `all` |
|
|
161
|
+
| `selector` | string | No | Limit extraction to elements matching this selector |
|
|
162
|
+
|
|
163
|
+
**Example**:
|
|
164
|
+
```json
|
|
165
|
+
{
|
|
166
|
+
"type": "links"
|
|
167
|
+
}
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
Returns structured JSON with all links, their text, and href values.
|
|
171
|
+
|
|
172
|
+
---
|
|
173
|
+
|
|
174
|
+
### `find_element_by_intent`
|
|
175
|
+
|
|
176
|
+
**What it does**: Uses AI to find elements by semantic description. Returns the best match with confidence score and accessibility information.
|
|
177
|
+
|
|
178
|
+
**Why you'd use it**: When you need to find something but don't know exactly how it's implemented — "the navigation menu" or "the search box in the header".
|
|
179
|
+
|
|
180
|
+
| Parameter | Type | Required | Description |
|
|
181
|
+
|-----------|------|----------|-------------|
|
|
182
|
+
| `intent` | string | Yes | Natural language description of the element |
|
|
183
|
+
| `context` | string | No | Additional context to narrow the search |
|
|
184
|
+
|
|
185
|
+
**Example**:
|
|
186
|
+
```json
|
|
187
|
+
{
|
|
188
|
+
"intent": "the main call-to-action button",
|
|
189
|
+
"context": "in the pricing section"
|
|
190
|
+
}
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
**Returns**: Selector, confidence score (0-1), accessibility score, and alternative matches.
|
|
194
|
+
|
|
195
|
+
**Note**: v7.4.17 added ARIA-first strategy — prioritizes `aria-label`, `role`, semantic HTML before falling back to classes/IDs.
|
|
196
|
+
|
|
197
|
+
---
|
|
198
|
+
|
|
199
|
+
### `analyze_page`
|
|
200
|
+
|
|
201
|
+
**What it does**: Examines page structure and returns inventory of interactive elements — forms, buttons, links, inputs.
|
|
202
|
+
|
|
203
|
+
**Why you'd use it**: Understand what's on a page before deciding what to interact with. Essential for building adaptive agents.
|
|
204
|
+
|
|
205
|
+
| Parameter | Type | Required | Description |
|
|
206
|
+
|-----------|------|----------|-------------|
|
|
207
|
+
| `detailed` | boolean | No | Include element attributes and positions. Default: false |
|
|
208
|
+
|
|
209
|
+
**Example**:
|
|
210
|
+
```json
|
|
211
|
+
{
|
|
212
|
+
"detailed": true
|
|
213
|
+
}
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
---
|
|
217
|
+
|
|
218
|
+
### `assert`
|
|
219
|
+
|
|
220
|
+
**What it does**: Verifies a condition using natural language and returns pass/fail with explanation.
|
|
221
|
+
|
|
222
|
+
**Why you'd use it**: Validate that actions had the expected result without writing complex assertion logic.
|
|
223
|
+
|
|
224
|
+
| Parameter | Type | Required | Description |
|
|
225
|
+
|-----------|------|----------|-------------|
|
|
226
|
+
| `condition` | string | Yes | What to check, in plain English |
|
|
227
|
+
|
|
228
|
+
**Example**:
|
|
229
|
+
```json
|
|
230
|
+
{
|
|
231
|
+
"condition": "the shopping cart shows 2 items"
|
|
232
|
+
}
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
**Returns**: `{ "passed": true/false, "reason": "explanation" }`
|
|
236
|
+
|
|
237
|
+
---
|
|
238
|
+
|
|
239
|
+
### `dismiss_overlay`
|
|
240
|
+
|
|
241
|
+
**What it does**: Detects and closes modal overlays — cookie consent banners, newsletter popups, age verification gates.
|
|
242
|
+
|
|
243
|
+
**Why you'd use it**: Clear blocking UI before interacting with the actual page content.
|
|
244
|
+
|
|
245
|
+
| Parameter | Type | Required | Description |
|
|
246
|
+
|-----------|------|----------|-------------|
|
|
247
|
+
| `type` | string | No | Overlay type: `auto`, `cookie`, `age-verify`, `newsletter`, `custom`. Default: `auto` |
|
|
248
|
+
| `customSelector` | string | No | Selector for custom overlay close button |
|
|
249
|
+
|
|
250
|
+
**Example**:
|
|
251
|
+
```json
|
|
252
|
+
{
|
|
253
|
+
"type": "auto"
|
|
254
|
+
}
|
|
255
|
+
```
|
|
256
|
+
|
|
257
|
+
**Note**: Constitutional Yellow zone — logged but proceeds automatically.
|
|
258
|
+
|
|
259
|
+
---
|
|
260
|
+
|
|
261
|
+
### `ask_user`
|
|
262
|
+
|
|
263
|
+
**What it does**: Creates a structured prompt to ask the human operator a question with predefined options.
|
|
264
|
+
|
|
265
|
+
**Why you'd use it**: When the automation needs human input to proceed — confirmation, selection, or decision that can't be automated.
|
|
266
|
+
|
|
267
|
+
| Parameter | Type | Required | Description |
|
|
268
|
+
|-----------|------|----------|-------------|
|
|
269
|
+
| `question` | string | Yes | The question to ask |
|
|
270
|
+
| `options` | array | No | Predefined answer options |
|
|
271
|
+
| `allowFreeform` | boolean | No | Allow typed response. Default: true |
|
|
272
|
+
|
|
273
|
+
**Example**:
|
|
274
|
+
```json
|
|
275
|
+
{
|
|
276
|
+
"question": "Which shipping method should I select?",
|
|
277
|
+
"options": ["Standard (5-7 days)", "Express (2-3 days)", "Overnight"]
|
|
278
|
+
}
|
|
279
|
+
```
|
|
280
|
+
|
|
281
|
+
---
|
|
282
|
+
|
|
283
|
+
## How Self-Healing Works
|
|
284
|
+
|
|
285
|
+
When a selector fails, CBrowser:
|
|
286
|
+
|
|
287
|
+
1. **Checks the healing cache** for previously learned mappings
|
|
288
|
+
2. **Analyzes the page** for elements matching the semantic intent
|
|
289
|
+
3. **Scores candidates** by text similarity, position, and accessibility attributes
|
|
290
|
+
4. **Returns the best match** if confidence exceeds 60%
|
|
291
|
+
5. **Caches the mapping** for faster future lookups
|
|
292
|
+
|
|
293
|
+
This means your automation adapts to site changes automatically. A redesign that moves the "Add to Cart" button? CBrowser finds it by intent, not by its old CSS class.
|
|
294
|
+
|
|
295
|
+
---
|
|
296
|
+
|
|
297
|
+
## Related Documentation
|
|
298
|
+
|
|
299
|
+
- [Constitutional Safety](/docs/Constitutional-Safety/) — How CBrowser classifies action risk
|
|
300
|
+
- [Tools Overview](/docs/Tools-Overview/) — All tools by category
|
|
301
|
+
- [Examples](/docs/Examples/) — Real-world automation patterns
|
|
302
|
+
|
|
303
|
+
---
|
|
304
|
+
|
|
305
|
+
*Last updated: v17.6.0*
|