chrome-cdp-cli 1.7.0 → 1.7.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.
|
@@ -126,148 +126,148 @@ Examples:
|
|
|
126
126
|
return [
|
|
127
127
|
{
|
|
128
128
|
name: 'cdp-cli',
|
|
129
|
-
description: 'Chrome DevTools Protocol CLI
|
|
130
|
-
instructions:
|
|
129
|
+
description: 'Chrome DevTools Protocol CLI Tool',
|
|
130
|
+
instructions: `Control Chrome browser through Chrome DevTools Protocol, supporting complete automation operations.
|
|
131
131
|
|
|
132
|
-
##
|
|
132
|
+
## Complete Command List
|
|
133
133
|
|
|
134
|
-
### 1. JavaScript
|
|
135
|
-
- **eval** -
|
|
134
|
+
### 1. JavaScript Execution
|
|
135
|
+
- **eval** - Execute JavaScript code and return results, supports async code and Promises
|
|
136
136
|
\`chrome-cdp-cli eval "document.title"\`
|
|
137
137
|
\`chrome-cdp-cli eval "fetch('/api/data').then(r => r.json())"\`
|
|
138
138
|
|
|
139
|
-
### 2.
|
|
140
|
-
- **screenshot** -
|
|
139
|
+
### 2. Page Screenshots and Snapshots
|
|
140
|
+
- **screenshot** - Capture page screenshot and save to file
|
|
141
141
|
\`chrome-cdp-cli screenshot --filename page.png\`
|
|
142
142
|
\`chrome-cdp-cli screenshot --filename fullpage.png --full-page\`
|
|
143
143
|
|
|
144
|
-
- **snapshot** -
|
|
144
|
+
- **snapshot** - Capture complete DOM snapshot (including structure, styles, layout)
|
|
145
145
|
\`chrome-cdp-cli snapshot --filename dom-snapshot.json\`
|
|
146
146
|
|
|
147
|
-
### 3.
|
|
148
|
-
- **click** -
|
|
147
|
+
### 3. Element Interaction
|
|
148
|
+
- **click** - Click page elements
|
|
149
149
|
\`chrome-cdp-cli click "#submit-button"\`
|
|
150
150
|
\`chrome-cdp-cli click ".menu-item" --timeout 10000\`
|
|
151
151
|
|
|
152
|
-
- **hover** -
|
|
152
|
+
- **hover** - Mouse hover over elements
|
|
153
153
|
\`chrome-cdp-cli hover "#dropdown-trigger"\`
|
|
154
154
|
|
|
155
|
-
- **fill** -
|
|
155
|
+
- **fill** - Fill form fields
|
|
156
156
|
\`chrome-cdp-cli fill "#username" "john@example.com"\`
|
|
157
157
|
\`chrome-cdp-cli fill "input[name='password']" "secret123"\`
|
|
158
158
|
|
|
159
|
-
- **fill_form** -
|
|
159
|
+
- **fill_form** - Batch fill forms
|
|
160
160
|
\`chrome-cdp-cli fill_form '{"#username": "john", "#password": "secret"}'\`
|
|
161
161
|
|
|
162
|
-
### 4.
|
|
163
|
-
- **drag** -
|
|
162
|
+
### 4. Advanced Interactions
|
|
163
|
+
- **drag** - Drag and drop operations
|
|
164
164
|
\`chrome-cdp-cli drag "#draggable" "#dropzone"\`
|
|
165
165
|
|
|
166
|
-
- **press_key** -
|
|
166
|
+
- **press_key** - Simulate keyboard input
|
|
167
167
|
\`chrome-cdp-cli press_key "Enter"\`
|
|
168
168
|
\`chrome-cdp-cli press_key "a" --modifiers Ctrl --selector "#input"\`
|
|
169
169
|
|
|
170
|
-
- **upload_file** -
|
|
170
|
+
- **upload_file** - File upload
|
|
171
171
|
\`chrome-cdp-cli upload_file "input[type='file']" "./document.pdf"\`
|
|
172
172
|
|
|
173
|
-
- **wait_for** -
|
|
173
|
+
- **wait_for** - Wait for elements to appear or meet conditions
|
|
174
174
|
\`chrome-cdp-cli wait_for "#loading" --condition hidden\`
|
|
175
175
|
\`chrome-cdp-cli wait_for "#submit-btn" --condition enabled\`
|
|
176
176
|
|
|
177
|
-
- **handle_dialog** -
|
|
177
|
+
- **handle_dialog** - Handle browser dialogs
|
|
178
178
|
\`chrome-cdp-cli handle_dialog accept\`
|
|
179
179
|
\`chrome-cdp-cli handle_dialog accept --text "user input"\`
|
|
180
180
|
|
|
181
|
-
### 5.
|
|
182
|
-
- **get_console_message** -
|
|
181
|
+
### 5. Monitoring Features
|
|
182
|
+
- **get_console_message** - Get latest console message
|
|
183
183
|
\`chrome-cdp-cli get_console_message\`
|
|
184
184
|
|
|
185
|
-
- **list_console_messages** -
|
|
185
|
+
- **list_console_messages** - List all console messages
|
|
186
186
|
\`chrome-cdp-cli list_console_messages --type error\`
|
|
187
187
|
|
|
188
|
-
- **get_network_request** -
|
|
188
|
+
- **get_network_request** - Get latest network request
|
|
189
189
|
\`chrome-cdp-cli get_network_request\`
|
|
190
190
|
|
|
191
|
-
- **list_network_requests** -
|
|
191
|
+
- **list_network_requests** - List all network requests
|
|
192
192
|
\`chrome-cdp-cli list_network_requests --method POST\`
|
|
193
193
|
|
|
194
|
-
### 6. IDE
|
|
195
|
-
- **install_cursor_command** -
|
|
194
|
+
### 6. IDE Integration
|
|
195
|
+
- **install_cursor_command** - Install Cursor commands
|
|
196
196
|
\`chrome-cdp-cli install_cursor_command\`
|
|
197
197
|
|
|
198
|
-
- **install_claude_skill** -
|
|
198
|
+
- **install_claude_skill** - Install Claude skills
|
|
199
199
|
\`chrome-cdp-cli install_claude_skill --skill-type personal\`
|
|
200
200
|
|
|
201
|
-
##
|
|
201
|
+
## Common Workflows
|
|
202
202
|
|
|
203
|
-
###
|
|
203
|
+
### Complete Form Testing Workflow
|
|
204
204
|
\`\`\`bash
|
|
205
|
-
# 1.
|
|
205
|
+
# 1. Wait for page to load
|
|
206
206
|
chrome-cdp-cli wait_for "#login-form" --condition visible
|
|
207
207
|
|
|
208
|
-
# 2.
|
|
208
|
+
# 2. Fill form
|
|
209
209
|
chrome-cdp-cli fill "#email" "test@example.com"
|
|
210
210
|
chrome-cdp-cli fill "#password" "password123"
|
|
211
211
|
|
|
212
|
-
# 3.
|
|
212
|
+
# 3. Submit form
|
|
213
213
|
chrome-cdp-cli click "#submit-button"
|
|
214
214
|
|
|
215
|
-
# 4.
|
|
215
|
+
# 4. Wait for result and take screenshot
|
|
216
216
|
chrome-cdp-cli wait_for "#success-message" --condition visible
|
|
217
217
|
chrome-cdp-cli screenshot --filename login-success.png
|
|
218
218
|
|
|
219
|
-
# 5.
|
|
219
|
+
# 5. Check console errors
|
|
220
220
|
chrome-cdp-cli list_console_messages --type error
|
|
221
221
|
\`\`\`
|
|
222
222
|
|
|
223
|
-
###
|
|
223
|
+
### File Upload Testing
|
|
224
224
|
\`\`\`bash
|
|
225
|
-
# 1.
|
|
225
|
+
# 1. Click upload button
|
|
226
226
|
chrome-cdp-cli click "#upload-trigger"
|
|
227
227
|
|
|
228
|
-
# 2.
|
|
228
|
+
# 2. Upload file
|
|
229
229
|
chrome-cdp-cli upload_file "input[type='file']" "./test-document.pdf"
|
|
230
230
|
|
|
231
|
-
# 3.
|
|
231
|
+
# 3. Wait for upload completion
|
|
232
232
|
chrome-cdp-cli wait_for ".upload-success" --condition visible
|
|
233
233
|
|
|
234
|
-
# 4.
|
|
234
|
+
# 4. Verify result
|
|
235
235
|
chrome-cdp-cli eval "document.querySelector('.file-name').textContent"
|
|
236
236
|
\`\`\`
|
|
237
237
|
|
|
238
|
-
###
|
|
238
|
+
### Drag and Drop Interaction Testing
|
|
239
239
|
\`\`\`bash
|
|
240
|
-
# 1.
|
|
240
|
+
# 1. Wait for elements to be available
|
|
241
241
|
chrome-cdp-cli wait_for "#draggable-item" --condition visible
|
|
242
242
|
chrome-cdp-cli wait_for "#drop-zone" --condition visible
|
|
243
243
|
|
|
244
|
-
# 2.
|
|
244
|
+
# 2. Perform drag and drop
|
|
245
245
|
chrome-cdp-cli drag "#draggable-item" "#drop-zone"
|
|
246
246
|
|
|
247
|
-
# 3.
|
|
247
|
+
# 3. Verify drag result
|
|
248
248
|
chrome-cdp-cli eval "document.querySelector('#drop-zone').children.length"
|
|
249
249
|
\`\`\`
|
|
250
250
|
|
|
251
|
-
###
|
|
251
|
+
### Keyboard Navigation Testing
|
|
252
252
|
\`\`\`bash
|
|
253
|
-
# 1.
|
|
253
|
+
# 1. Focus on input field
|
|
254
254
|
chrome-cdp-cli click "#search-input"
|
|
255
255
|
|
|
256
|
-
# 2.
|
|
256
|
+
# 2. Type text
|
|
257
257
|
chrome-cdp-cli press_key "t"
|
|
258
258
|
chrome-cdp-cli press_key "e"
|
|
259
259
|
chrome-cdp-cli press_key "s"
|
|
260
260
|
chrome-cdp-cli press_key "t"
|
|
261
261
|
|
|
262
|
-
# 3.
|
|
263
|
-
chrome-cdp-cli press_key "a" --modifiers Ctrl #
|
|
264
|
-
chrome-cdp-cli press_key "Enter" #
|
|
262
|
+
# 3. Use keyboard shortcuts
|
|
263
|
+
chrome-cdp-cli press_key "a" --modifiers Ctrl # Select all
|
|
264
|
+
chrome-cdp-cli press_key "Enter" # Submit
|
|
265
265
|
|
|
266
|
-
# 4.
|
|
266
|
+
# 4. Handle possible confirmation dialog
|
|
267
267
|
chrome-cdp-cli handle_dialog accept
|
|
268
268
|
\`\`\`
|
|
269
269
|
|
|
270
|
-
|
|
270
|
+
Commands automatically connect to Chrome instance running on localhost:9222.`,
|
|
271
271
|
examples: [
|
|
272
272
|
'chrome-cdp-cli eval "document.title"',
|
|
273
273
|
'chrome-cdp-cli screenshot --filename page.png',
|
|
@@ -290,74 +290,74 @@ chrome-cdp-cli handle_dialog accept
|
|
|
290
290
|
|
|
291
291
|
${command.instructions}
|
|
292
292
|
|
|
293
|
-
##
|
|
293
|
+
## Usage Examples
|
|
294
294
|
|
|
295
295
|
${examples}
|
|
296
296
|
|
|
297
|
-
##
|
|
297
|
+
## Prerequisites
|
|
298
298
|
|
|
299
|
-
|
|
299
|
+
Ensure Chrome browser is started with remote debugging enabled:
|
|
300
300
|
|
|
301
301
|
\`\`\`bash
|
|
302
302
|
chrome --remote-debugging-port=9222
|
|
303
303
|
\`\`\`
|
|
304
304
|
|
|
305
|
-
|
|
305
|
+
Or on macOS:
|
|
306
306
|
|
|
307
307
|
\`\`\`bash
|
|
308
308
|
/Applications/Google\\ Chrome.app/Contents/MacOS/Google\\ Chrome --remote-debugging-port=9222
|
|
309
309
|
\`\`\`
|
|
310
310
|
|
|
311
|
-
##
|
|
311
|
+
## Global Options
|
|
312
312
|
|
|
313
|
-
|
|
313
|
+
All commands support the following global options:
|
|
314
314
|
|
|
315
|
-
- \`--host <hostname>\`: Chrome DevTools
|
|
316
|
-
- \`--port <number>\`: Chrome DevTools
|
|
317
|
-
- \`--format <json|text>\`:
|
|
318
|
-
- \`--verbose\`:
|
|
319
|
-
- \`--quiet\`:
|
|
320
|
-
- \`--timeout <ms>\`:
|
|
315
|
+
- \`--host <hostname>\`: Chrome DevTools host address (default: localhost)
|
|
316
|
+
- \`--port <number>\`: Chrome DevTools port (default: 9222)
|
|
317
|
+
- \`--format <json|text>\`: Output format (default: json)
|
|
318
|
+
- \`--verbose\`: Enable verbose logging
|
|
319
|
+
- \`--quiet\`: Silent mode
|
|
320
|
+
- \`--timeout <ms>\`: Command timeout
|
|
321
321
|
|
|
322
|
-
##
|
|
322
|
+
## Common Workflows
|
|
323
323
|
|
|
324
|
-
###
|
|
324
|
+
### Web Automation Testing
|
|
325
325
|
\`\`\`bash
|
|
326
|
-
# 1.
|
|
326
|
+
# 1. Navigate to page and take screenshot
|
|
327
327
|
chrome-cdp-cli eval "window.location.href = 'https://example.com'"
|
|
328
328
|
chrome-cdp-cli screenshot --filename before.png
|
|
329
329
|
|
|
330
|
-
# 2.
|
|
330
|
+
# 2. Fill form
|
|
331
331
|
chrome-cdp-cli eval "document.querySelector('#email').value = 'test@example.com'"
|
|
332
332
|
chrome-cdp-cli eval "document.querySelector('#password').value = 'password123'"
|
|
333
333
|
|
|
334
|
-
# 3.
|
|
334
|
+
# 3. Submit and check results
|
|
335
335
|
chrome-cdp-cli eval "document.querySelector('#submit').click()"
|
|
336
336
|
chrome-cdp-cli screenshot --filename after.png
|
|
337
337
|
chrome-cdp-cli list_console_messages --type error
|
|
338
338
|
\`\`\`
|
|
339
339
|
|
|
340
|
-
### API
|
|
340
|
+
### API Call Monitoring
|
|
341
341
|
\`\`\`bash
|
|
342
|
-
# 1.
|
|
342
|
+
# 1. Start monitoring network requests
|
|
343
343
|
chrome-cdp-cli eval "fetch('/api/users').then(r => r.json())"
|
|
344
344
|
|
|
345
|
-
# 2.
|
|
345
|
+
# 2. View network requests
|
|
346
346
|
chrome-cdp-cli list_network_requests --method POST
|
|
347
347
|
|
|
348
|
-
# 3.
|
|
348
|
+
# 3. Get latest request details
|
|
349
349
|
chrome-cdp-cli get_network_request
|
|
350
350
|
\`\`\`
|
|
351
351
|
|
|
352
|
-
###
|
|
352
|
+
### Page Analysis
|
|
353
353
|
\`\`\`bash
|
|
354
|
-
# 1.
|
|
354
|
+
# 1. Get basic page information
|
|
355
355
|
chrome-cdp-cli eval "({title: document.title, url: location.href, links: document.querySelectorAll('a').length})"
|
|
356
356
|
|
|
357
|
-
# 2.
|
|
357
|
+
# 2. Capture complete page structure
|
|
358
358
|
chrome-cdp-cli snapshot --filename page-analysis.json
|
|
359
359
|
|
|
360
|
-
# 3.
|
|
360
|
+
# 3. Check console errors
|
|
361
361
|
chrome-cdp-cli list_console_messages --type error
|
|
362
362
|
\`\`\`
|
|
363
363
|
`;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "chrome-cdp-cli",
|
|
3
|
-
"version": "1.7.
|
|
3
|
+
"version": "1.7.2",
|
|
4
4
|
"description": "LLM-first browser automation CLI via Chrome DevTools Protocol. Eval-first design optimized for AI assistants - LLMs write JavaScript scripts for rapid validation. Features: JavaScript execution, element interaction, screenshots, DOM snapshots, console/network monitoring. Built-in IDE integration for Cursor and Claude.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -34,7 +34,8 @@
|
|
|
34
34
|
"package": "npm run build:prod && npm pack",
|
|
35
35
|
"prepublishOnly": "npm run test:ci && npm run build:prod",
|
|
36
36
|
"prepack": "npm run build:prod",
|
|
37
|
-
"verify": "npm run lint && npm run test:ci && npm run build:prod"
|
|
37
|
+
"verify": "npm run lint && npm run test:ci && npm run build:prod",
|
|
38
|
+
"postinstall": "node -e \"console.log('\\n🎉 chrome-cdp-cli installed successfully!\\n\\n📋 Quick Start:\\n 1. Start Chrome with debugging: chrome --remote-debugging-port=9222\\n 2. Try: chrome-cdp-cli eval \\\"document.title\\\"\\n 3. Get help: chrome-cdp-cli --help\\n\\n🔗 More info: https://github.com/nicoster/chrome-devtools-cli\\n')\""
|
|
38
39
|
},
|
|
39
40
|
"keywords": [
|
|
40
41
|
"chrome",
|