chrome-cdp-cli 1.9.0 → 2.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/README.md +105 -16
- package/dist/cli/ArgumentParser.js +506 -0
- package/dist/cli/CLIApplication.js +91 -6
- package/dist/cli/CLIInterface.js +25 -82
- package/dist/cli/CommandRouter.js +4 -4
- package/dist/cli/CommandSchemaRegistry.js +614 -0
- package/dist/cli/EnhancedCLIInterface.js +230 -0
- package/dist/cli/HelpSystem.js +683 -0
- package/dist/cli/OutputFormatter.js +367 -0
- package/dist/cli/OutputManager.js +151 -0
- package/dist/cli/demo-enhanced-help.js +88 -0
- package/dist/cli/demo-enhanced-parser.js +79 -0
- package/dist/cli/demo-output-formatting.js +261 -0
- package/dist/cli/index.js +24 -4
- package/dist/cli/interfaces/ArgumentParser.js +2 -0
- package/dist/config/ConfigurationManager.js +357 -0
- package/dist/config/example.js +54 -0
- package/dist/config/index.js +21 -0
- package/dist/config/interfaces.js +35 -0
- package/dist/config/utils.js +238 -0
- package/dist/handlers/InstallClaudeSkillHandler.js +271 -124
- package/dist/handlers/InstallCursorCommandHandler.js +32 -133
- package/dist/handlers/ListConsoleMessagesHandler.js +63 -8
- package/dist/handlers/ListNetworkRequestsHandler.js +37 -3
- package/dist/handlers/TakeSnapshotHandler.js +28 -8
- package/dist/handlers/index.js +0 -2
- package/dist/proxy/server/MessageStore.js +11 -80
- package/package.json +3 -1
- package/dist/handlers/GetConsoleMessageHandler.js +0 -161
- package/dist/handlers/GetNetworkRequestHandler.js +0 -108
|
@@ -144,109 +144,267 @@ Examples:
|
|
|
144
144
|
}
|
|
145
145
|
generateClaudeSkill() {
|
|
146
146
|
return {
|
|
147
|
-
name: 'cdp-cli',
|
|
148
|
-
description: 'Chrome browser automation
|
|
149
|
-
instructions: `# Chrome Browser Automation
|
|
147
|
+
name: 'cdp-cli-enhanced',
|
|
148
|
+
description: 'Advanced Chrome browser automation using enhanced DevTools CLI v2.0 with configuration management, error handling, contextual help, and comprehensive testing workflows. Use for complex web automation, testing, form handling, performance monitoring, and CI/CD integration.',
|
|
149
|
+
instructions: `# Enhanced Chrome Browser Automation
|
|
150
150
|
|
|
151
151
|
## Instructions
|
|
152
|
-
Use this skill when the user needs
|
|
153
|
-
-
|
|
154
|
-
-
|
|
155
|
-
-
|
|
156
|
-
-
|
|
157
|
-
-
|
|
158
|
-
-
|
|
159
|
-
- Perform comprehensive web automation and testing
|
|
152
|
+
Use this skill when the user needs advanced browser automation with:
|
|
153
|
+
- Configuration-driven workflows with profiles and aliases
|
|
154
|
+
- Enhanced error handling with contextual help and recovery
|
|
155
|
+
- Comprehensive testing with evidence capture
|
|
156
|
+
- Performance monitoring and metrics collection
|
|
157
|
+
- CI/CD integration with structured reporting
|
|
158
|
+
- Plugin-based extensibility for custom commands
|
|
160
159
|
|
|
161
|
-
##
|
|
160
|
+
## Enhanced CLI Features (v2.0)
|
|
162
161
|
|
|
163
|
-
###
|
|
164
|
-
|
|
165
|
-
\`chrome-cdp-cli eval "document.title"\`
|
|
166
|
-
\`chrome-cdp-cli eval "fetch('/api/data').then(r => r.json())"\`
|
|
162
|
+
### Configuration Management
|
|
163
|
+
Use YAML/JSON configuration files with profiles for different environments:
|
|
167
164
|
|
|
168
|
-
|
|
169
|
-
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
165
|
+
\`\`\`yaml
|
|
166
|
+
# .chrome-cdp-cli.yaml
|
|
167
|
+
profiles:
|
|
168
|
+
development:
|
|
169
|
+
host: localhost
|
|
170
|
+
port: 9222
|
|
171
|
+
debug: true
|
|
172
|
+
verbose: true
|
|
173
|
+
|
|
174
|
+
testing:
|
|
175
|
+
host: test-chrome
|
|
176
|
+
port: 9223
|
|
177
|
+
quiet: true
|
|
178
|
+
outputFormat: json
|
|
179
|
+
|
|
180
|
+
production:
|
|
181
|
+
host: prod-chrome
|
|
182
|
+
port: 9222
|
|
183
|
+
quiet: true
|
|
184
|
+
timeout: 60000
|
|
185
|
+
|
|
186
|
+
aliases:
|
|
187
|
+
health-check: eval "document.readyState === 'complete'"
|
|
188
|
+
capture-evidence: screenshot --filename evidence-$(date +%s).png
|
|
189
|
+
check-console: console --types error
|
|
190
|
+
|
|
191
|
+
commands:
|
|
192
|
+
screenshot:
|
|
193
|
+
defaults:
|
|
194
|
+
format: png
|
|
195
|
+
quality: 95
|
|
196
|
+
fullPage: true
|
|
197
|
+
\`\`\`
|
|
173
198
|
|
|
174
|
-
###
|
|
175
|
-
-
|
|
176
|
-
|
|
177
|
-
-
|
|
178
|
-
|
|
179
|
-
-
|
|
180
|
-
|
|
181
|
-
-
|
|
182
|
-
|
|
199
|
+
### Enhanced Global Options
|
|
200
|
+
- \`--profile <name>\`: Use configuration profile
|
|
201
|
+
- \`--config <path>\`: Specify configuration file
|
|
202
|
+
- \`--debug\`: Enable debug mode with detailed logging
|
|
203
|
+
- \`--verbose\`: Enable verbose output with timing
|
|
204
|
+
- \`--quiet\`: Silent mode for CI/CD
|
|
205
|
+
- \`--format <json|text|yaml>\`: Enhanced output formats
|
|
206
|
+
- \`--help topic <topic>\`: Get contextual help on topics
|
|
207
|
+
|
|
208
|
+
### Advanced Error Handling
|
|
209
|
+
The CLI provides contextual help and suggestions when commands fail:
|
|
210
|
+
|
|
211
|
+
\`\`\`bash
|
|
212
|
+
# Automatic contextual help on errors
|
|
213
|
+
chrome-cdp-cli click "#nonexistent-element"
|
|
214
|
+
# Shows: selector validation tips, alternatives, related help topics
|
|
215
|
+
|
|
216
|
+
# Debug mode for detailed error information
|
|
217
|
+
chrome-cdp-cli --debug --verbose click "#problematic-element"
|
|
218
|
+
# Shows: execution logs, CDP messages, timing information
|
|
219
|
+
\`\`\`
|
|
220
|
+
|
|
221
|
+
## Complete Command Reference
|
|
222
|
+
|
|
223
|
+
### JavaScript Execution
|
|
224
|
+
- **eval**: Execute JavaScript code with enhanced error handling
|
|
225
|
+
\`chrome-cdp-cli --profile development eval "document.title"\`
|
|
226
|
+
\`chrome-cdp-cli --format json eval "performance.timing"\`
|
|
227
|
+
\`chrome-cdp-cli eval --file automation-script.js\`
|
|
228
|
+
|
|
229
|
+
### Visual Capture with Enhanced Options
|
|
230
|
+
- **screenshot**: Advanced screenshot capture
|
|
231
|
+
\`chrome-cdp-cli --profile testing screenshot --filename test-result.png\`
|
|
232
|
+
\`chrome-cdp-cli screenshot --full-page --format jpeg --quality 90\`
|
|
233
|
+
- **snapshot**: Complete DOM snapshots with metadata
|
|
234
|
+
\`chrome-cdp-cli --format json snapshot --filename dom-analysis.json\`
|
|
235
|
+
|
|
236
|
+
### Enhanced Element Interaction
|
|
237
|
+
- **click**: Click with retry and error recovery
|
|
238
|
+
\`chrome-cdp-cli --debug click "#submit-button"\`
|
|
239
|
+
\`chrome-cdp-cli click ".slow-loading-button" --timeout 15000\`
|
|
240
|
+
- **hover**: Hover with timing control
|
|
241
|
+
\`chrome-cdp-cli hover "#dropdown-trigger" --timeout 5000\`
|
|
242
|
+
- **fill**: Form filling with validation
|
|
243
|
+
\`chrome-cdp-cli fill "#username" "john@example.com" --no-clear\`
|
|
244
|
+
- **fill_form**: Batch form operations with error handling
|
|
245
|
+
\`chrome-cdp-cli fill_form --fields-file form-data.json --continue-on-error\`
|
|
183
246
|
|
|
184
247
|
### Advanced Interactions
|
|
185
|
-
- **drag**:
|
|
186
|
-
\`chrome-cdp-cli drag "#draggable" "#dropzone"\`
|
|
187
|
-
- **press_key**:
|
|
188
|
-
\`chrome-cdp-cli press_key "Enter"\`
|
|
189
|
-
\`chrome-cdp-cli press_key "
|
|
190
|
-
- **upload_file**:
|
|
248
|
+
- **drag**: Enhanced drag and drop
|
|
249
|
+
\`chrome-cdp-cli --verbose drag "#draggable" "#dropzone"\`
|
|
250
|
+
- **press_key**: Keyboard simulation with element targeting
|
|
251
|
+
\`chrome-cdp-cli press_key "Enter" --selector "#search-input"\`
|
|
252
|
+
\`chrome-cdp-cli press_key "s" --modifiers Ctrl,Shift\`
|
|
253
|
+
- **upload_file**: File upload with validation
|
|
191
254
|
\`chrome-cdp-cli upload_file "input[type='file']" "./document.pdf"\`
|
|
192
|
-
- **wait_for**:
|
|
193
|
-
\`chrome-cdp-cli wait_for "#loading" --condition hidden\`
|
|
255
|
+
- **wait_for**: Advanced waiting with conditions
|
|
256
|
+
\`chrome-cdp-cli wait_for "#loading" --condition hidden --timeout 30000\`
|
|
194
257
|
\`chrome-cdp-cli wait_for "#submit-btn" --condition enabled\`
|
|
195
|
-
- **handle_dialog**:
|
|
196
|
-
\`chrome-cdp-cli handle_dialog accept\`
|
|
197
|
-
|
|
258
|
+
- **handle_dialog**: Dialog handling with text input
|
|
259
|
+
\`chrome-cdp-cli handle_dialog accept --text "confirmation text"\`
|
|
260
|
+
|
|
261
|
+
### Enhanced Monitoring
|
|
262
|
+
- **console**: Console monitoring with filtering
|
|
263
|
+
\`chrome-cdp-cli --format json console --latest\`
|
|
264
|
+
\`chrome-cdp-cli console --types error,warn\`
|
|
265
|
+
- **network**: Network monitoring with filters
|
|
266
|
+
\`chrome-cdp-cli --format json network --latest\`
|
|
267
|
+
\`chrome-cdp-cli network --filter '{"methods":["POST"],"statusCodes":[200,201]}'\`
|
|
268
|
+
|
|
269
|
+
### Help System
|
|
270
|
+
- **help**: Comprehensive help with topics
|
|
271
|
+
\`chrome-cdp-cli help\` - General help with categorized commands
|
|
272
|
+
\`chrome-cdp-cli help eval\` - Command-specific help with examples
|
|
273
|
+
\`chrome-cdp-cli help topic configuration\` - Configuration management
|
|
274
|
+
\`chrome-cdp-cli help topic selectors\` - CSS selector guide
|
|
275
|
+
\`chrome-cdp-cli help topic automation\` - Best practices
|
|
276
|
+
\`chrome-cdp-cli help topic debugging\` - Troubleshooting guide
|
|
277
|
+
|
|
278
|
+
## Enhanced Automation Workflows
|
|
279
|
+
|
|
280
|
+
### Configuration-Driven Testing
|
|
281
|
+
\`\`\`bash
|
|
282
|
+
# Load testing profile
|
|
283
|
+
chrome-cdp-cli --profile testing --config test-config.yaml
|
|
284
|
+
|
|
285
|
+
# Execute test suite with error recovery
|
|
286
|
+
chrome-cdp-cli eval --file test-suite.js || {
|
|
287
|
+
echo "Test failed, capturing evidence..."
|
|
288
|
+
chrome-cdp-cli capture-evidence
|
|
289
|
+
chrome-cdp-cli check-console
|
|
290
|
+
exit 1
|
|
291
|
+
}
|
|
198
292
|
|
|
199
|
-
|
|
200
|
-
-
|
|
201
|
-
|
|
202
|
-
- **list_console_messages**: List all console messages
|
|
203
|
-
\`chrome-cdp-cli list_console_messages --type error\`
|
|
204
|
-
- **get_network_request**: Get latest network request
|
|
205
|
-
\`chrome-cdp-cli get_network_request\`
|
|
206
|
-
- **list_network_requests**: List all network requests
|
|
207
|
-
\`chrome-cdp-cli list_network_requests --method POST\`
|
|
293
|
+
# Generate structured report
|
|
294
|
+
chrome-cdp-cli --format json eval "generateTestReport()" > test-results.json
|
|
295
|
+
\`\`\`
|
|
208
296
|
|
|
209
|
-
###
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
297
|
+
### Performance Monitoring Workflow
|
|
298
|
+
\`\`\`bash
|
|
299
|
+
# Set up performance monitoring
|
|
300
|
+
chrome-cdp-cli --profile performance --verbose
|
|
301
|
+
|
|
302
|
+
# Navigate and collect metrics
|
|
303
|
+
chrome-cdp-cli eval "window.location.href = 'https://example.com'"
|
|
304
|
+
chrome-cdp-cli wait_for "#main-content" --timeout 30000
|
|
305
|
+
|
|
306
|
+
# Collect comprehensive performance data
|
|
307
|
+
chrome-cdp-cli --format json eval "
|
|
308
|
+
const timing = performance.timing;
|
|
309
|
+
const navigation = performance.getEntriesByType('navigation')[0];
|
|
310
|
+
const resources = performance.getEntriesByType('resource');
|
|
311
|
+
|
|
312
|
+
return {
|
|
313
|
+
loadTime: timing.loadEventEnd - timing.navigationStart,
|
|
314
|
+
domContentLoaded: timing.domContentLoadedEventEnd - timing.navigationStart,
|
|
315
|
+
firstPaint: navigation.loadEventEnd,
|
|
316
|
+
resourceCount: resources.length,
|
|
317
|
+
resourceSizes: resources.map(r => ({name: r.name, size: r.transferSize}))
|
|
318
|
+
};
|
|
319
|
+
" > performance-metrics.json
|
|
320
|
+
\`\`\`
|
|
229
321
|
|
|
230
|
-
###
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
322
|
+
### Advanced Form Testing
|
|
323
|
+
\`\`\`bash
|
|
324
|
+
# Configure for form testing
|
|
325
|
+
chrome-cdp-cli --profile development --debug
|
|
234
326
|
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
2. Type text: \`press_key "search term"\`
|
|
238
|
-
3. Use shortcuts: \`press_key "a" --modifiers Ctrl\` (select all)
|
|
239
|
-
4. Submit: \`press_key "Enter"\`
|
|
327
|
+
# Batch form filling with comprehensive error handling
|
|
328
|
+
chrome-cdp-cli fill_form --fields-file form-test-data.json --continue-on-error --timeout 15000
|
|
240
329
|
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
330
|
+
# Validate form submission with evidence capture
|
|
331
|
+
chrome-cdp-cli click "#submit-button"
|
|
332
|
+
chrome-cdp-cli wait_for ".success-message, .error-message" --timeout 10000
|
|
333
|
+
|
|
334
|
+
# Capture validation results
|
|
335
|
+
chrome-cdp-cli --format json eval "
|
|
336
|
+
const form = document.querySelector('#test-form');
|
|
337
|
+
const errors = Array.from(form.querySelectorAll('.error')).map(e => e.textContent);
|
|
338
|
+
const success = document.querySelector('.success-message');
|
|
339
|
+
return {
|
|
340
|
+
errors,
|
|
341
|
+
success: !!success,
|
|
342
|
+
timestamp: new Date().toISOString(),
|
|
343
|
+
formData: new FormData(form)
|
|
344
|
+
};
|
|
345
|
+
" > validation-results.json
|
|
346
|
+
\`\`\`
|
|
244
347
|
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
348
|
+
### CI/CD Integration
|
|
349
|
+
\`\`\`bash
|
|
350
|
+
# Headless Chrome setup for CI
|
|
351
|
+
chrome --headless --remote-debugging-port=9222 --user-data-dir=/tmp/chrome-ci &
|
|
352
|
+
|
|
353
|
+
# Execute tests with CI profile
|
|
354
|
+
chrome-cdp-cli --profile ci --quiet eval --file ci-test-suite.js
|
|
355
|
+
|
|
356
|
+
# Generate JUnit-compatible reports
|
|
357
|
+
chrome-cdp-cli --format json eval "generateJUnitReport()" > test-results.xml
|
|
358
|
+
|
|
359
|
+
# Capture evidence on failures
|
|
360
|
+
if [ $? -ne 0 ]; then
|
|
361
|
+
chrome-cdp-cli screenshot --filename failure-evidence.png
|
|
362
|
+
chrome-cdp-cli console --types error > console-errors.json
|
|
363
|
+
fi
|
|
364
|
+
\`\`\`
|
|
365
|
+
|
|
366
|
+
## Enhanced Prerequisites
|
|
367
|
+
|
|
368
|
+
### Chrome Setup with Security
|
|
369
|
+
\`\`\`bash
|
|
370
|
+
# Always use --user-data-dir for security (required)
|
|
371
|
+
chrome --remote-debugging-port=9222 --user-data-dir=/tmp/chrome-debug
|
|
372
|
+
|
|
373
|
+
# Headless mode for CI/CD
|
|
374
|
+
chrome --headless --remote-debugging-port=9222 --user-data-dir=/tmp/chrome-ci
|
|
375
|
+
|
|
376
|
+
# With additional automation flags
|
|
377
|
+
chrome --remote-debugging-port=9222 --user-data-dir=/tmp/chrome-debug --no-first-run --no-default-browser-check
|
|
378
|
+
\`\`\`
|
|
379
|
+
|
|
380
|
+
### Configuration File Setup
|
|
381
|
+
Create \`.chrome-cdp-cli.yaml\` in your project root with appropriate profiles for your environments.
|
|
382
|
+
|
|
383
|
+
## Documentation and Support
|
|
384
|
+
|
|
385
|
+
### Available Help Topics
|
|
386
|
+
- \`configuration\` - YAML configuration, profiles, environment setup
|
|
387
|
+
- \`selectors\` - CSS selector guide and best practices
|
|
388
|
+
- \`automation\` - Browser automation workflows and patterns
|
|
389
|
+
- \`debugging\` - Troubleshooting and error resolution
|
|
390
|
+
- \`scripting\` - Integration with scripts and CI/CD
|
|
391
|
+
- \`performance\` - Performance monitoring and optimization
|
|
392
|
+
|
|
393
|
+
### Contextual Help
|
|
394
|
+
Commands automatically provide contextual help when they fail, including:
|
|
395
|
+
- Specific error analysis and suggestions
|
|
396
|
+
- Alternative approaches and workarounds
|
|
397
|
+
- Related commands and help topics
|
|
398
|
+
- Configuration recommendations
|
|
399
|
+
|
|
400
|
+
### Plugin System
|
|
401
|
+
Extend functionality with plugins:
|
|
402
|
+
\`chrome-cdp-cli --plugin-dir ./plugins custom-command\`
|
|
403
|
+
|
|
404
|
+
For comprehensive documentation, see:
|
|
405
|
+
- Configuration Guide: docs/CONFIGURATION.md
|
|
406
|
+
- Plugin Development: docs/PLUGIN_DEVELOPMENT.md
|
|
407
|
+
- Advanced Help Topics: \`chrome-cdp-cli help topic <topic>\`
|
|
250
408
|
- \`--verbose\`: Enable detailed logging
|
|
251
409
|
- \`--timeout <ms>\`: Operation timeout`,
|
|
252
410
|
allowedTools: ['Execute', 'Read', 'Write']
|
|
@@ -256,6 +414,9 @@ All commands support:
|
|
|
256
414
|
const frontmatter = `---
|
|
257
415
|
name: ${skill.name}
|
|
258
416
|
description: ${skill.description}
|
|
417
|
+
version: 2.0.0
|
|
418
|
+
category: browser-automation
|
|
419
|
+
tools: [chrome-cdp-cli]
|
|
259
420
|
${skill.allowedTools ? `allowedTools: [${skill.allowedTools.map(t => `"${t}"`).join(', ')}]` : ''}
|
|
260
421
|
---
|
|
261
422
|
|
|
@@ -408,18 +569,18 @@ chrome-cdp-cli snapshot --filename form-state.json
|
|
|
408
569
|
|
|
409
570
|
### Console Messages
|
|
410
571
|
\`\`\`bash
|
|
411
|
-
chrome-cdp-cli
|
|
412
|
-
chrome-cdp-cli
|
|
413
|
-
chrome-cdp-cli
|
|
414
|
-
chrome-cdp-cli
|
|
572
|
+
chrome-cdp-cli console --latest
|
|
573
|
+
chrome-cdp-cli console
|
|
574
|
+
chrome-cdp-cli console --types error
|
|
575
|
+
chrome-cdp-cli console --types warn
|
|
415
576
|
\`\`\`
|
|
416
577
|
|
|
417
578
|
### Network Requests
|
|
418
579
|
\`\`\`bash
|
|
419
|
-
chrome-cdp-cli
|
|
420
|
-
chrome-cdp-cli
|
|
421
|
-
chrome-cdp-cli
|
|
422
|
-
chrome-cdp-cli
|
|
580
|
+
chrome-cdp-cli network --latest
|
|
581
|
+
chrome-cdp-cli network
|
|
582
|
+
chrome-cdp-cli network --filter '{"methods":["POST"]}'
|
|
583
|
+
chrome-cdp-cli network --filter '{"methods":["GET"]}'
|
|
423
584
|
\`\`\`
|
|
424
585
|
|
|
425
586
|
## Complete Workflow Examples
|
|
@@ -443,7 +604,7 @@ chrome-cdp-cli wait_for "#dashboard" --condition visible --timeout 10000
|
|
|
443
604
|
chrome-cdp-cli screenshot --filename login-success.png
|
|
444
605
|
|
|
445
606
|
# 6. Check for any errors
|
|
446
|
-
chrome-cdp-cli
|
|
607
|
+
chrome-cdp-cli console --types error
|
|
447
608
|
\`\`\`
|
|
448
609
|
|
|
449
610
|
### File Upload Workflow
|
|
@@ -756,39 +917,25 @@ Handle browser dialogs (alert, confirm, prompt).
|
|
|
756
917
|
|
|
757
918
|
### Monitoring
|
|
758
919
|
|
|
759
|
-
####
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
**Syntax:** \`chrome-cdp-cli get_console_message [options]\`
|
|
763
|
-
|
|
764
|
-
**Options:**
|
|
765
|
-
- \`--type <log|info|warn|error>\`: Filter by message type
|
|
766
|
-
|
|
767
|
-
#### list_console_messages
|
|
768
|
-
List all console messages.
|
|
769
|
-
|
|
770
|
-
**Syntax:** \`chrome-cdp-cli list_console_messages [options]\`
|
|
771
|
-
|
|
772
|
-
**Options:**
|
|
773
|
-
- \`--type <log|info|warn|error>\`: Filter by message type
|
|
774
|
-
- \`--limit <number>\`: Maximum number of messages to return
|
|
775
|
-
|
|
776
|
-
#### get_network_request
|
|
777
|
-
Get the latest network request.
|
|
920
|
+
#### console
|
|
921
|
+
List console messages or get the latest message.
|
|
778
922
|
|
|
779
|
-
**Syntax:** \`chrome-cdp-cli
|
|
923
|
+
**Syntax:** \`chrome-cdp-cli console [options]\`
|
|
780
924
|
|
|
781
925
|
**Options:**
|
|
782
|
-
- \`--
|
|
926
|
+
- \`--latest\`: Get only the latest message
|
|
927
|
+
- \`--types <types>\`: Filter by message types (comma-separated: log,info,warn,error,debug)
|
|
928
|
+
- \`--textPattern <pattern>\`: Filter by text pattern (regex)
|
|
929
|
+
- \`--maxMessages <count>\`: Maximum number of messages to return
|
|
783
930
|
|
|
784
|
-
####
|
|
785
|
-
List
|
|
931
|
+
#### network
|
|
932
|
+
List network requests or get the latest request.
|
|
786
933
|
|
|
787
|
-
**Syntax:** \`chrome-cdp-cli
|
|
934
|
+
**Syntax:** \`chrome-cdp-cli network [options]\`
|
|
788
935
|
|
|
789
936
|
**Options:**
|
|
790
|
-
- \`--
|
|
791
|
-
- \`--
|
|
937
|
+
- \`--latest\`: Get only the latest request
|
|
938
|
+
- \`--filter <json>\`: Filter requests (JSON string with methods, urlPattern, statusCodes, etc.)
|
|
792
939
|
|
|
793
940
|
### IDE Integration
|
|
794
941
|
|
|
@@ -950,7 +1097,7 @@ Element is present and disabled (for form elements):
|
|
|
950
1097
|
chrome-cdp-cli screenshot --filename test-result.png
|
|
951
1098
|
|
|
952
1099
|
# Check for errors
|
|
953
|
-
chrome-cdp-cli
|
|
1100
|
+
chrome-cdp-cli console --types error
|
|
954
1101
|
\`\`\`
|
|
955
1102
|
|
|
956
1103
|
### Automated Testing Script
|
|
@@ -995,7 +1142,7 @@ chrome-cdp-cli screenshot --filename final-state.png
|
|
|
995
1142
|
chrome-cdp-cli snapshot --filename final-dom.json
|
|
996
1143
|
|
|
997
1144
|
# Check for errors
|
|
998
|
-
ERROR_COUNT=$(chrome-cdp-cli
|
|
1145
|
+
ERROR_COUNT=$(chrome-cdp-cli console --types error | jq length)
|
|
999
1146
|
if [ "$ERROR_COUNT" -gt 0 ]; then
|
|
1000
1147
|
echo "Test failed: $ERROR_COUNT console errors found"
|
|
1001
1148
|
exit 1
|