chrome-cdp-cli 2.0.5 → 2.1.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/cli/ArgumentParser.js +172 -92
- package/dist/cli/CLIApplication.js +155 -82
- package/dist/cli/CommandRouter.js +98 -74
- package/dist/cli/CommandSchemaRegistry.js +506 -398
- package/dist/cli/HelpSystem.js +286 -256
- package/dist/handlers/ClickHandler.js +91 -27
- package/dist/handlers/InstallClaudeSkillHandler.js +220 -220
- package/dist/handlers/InstallCursorCommandHandler.js +60 -60
- package/dist/handlers/ListConsoleMessagesHandler.js +126 -178
- package/dist/handlers/ListNetworkRequestsHandler.js +128 -108
- package/dist/handlers/RestartProxyHandler.js +4 -4
- package/dist/handlers/TakeScreenshotHandler.js +70 -59
- package/dist/handlers/TakeSnapshotHandler.js +223 -165
- package/dist/handlers/index.js +0 -1
- package/dist/monitors/ConsoleMonitor.js +29 -0
- package/dist/monitors/NetworkMonitor.js +43 -19
- package/dist/proxy/server/CDPProxyServer.js +5 -1
- package/dist/proxy/server/CommandExecutionService.js +1 -1
- package/dist/proxy/server/ProxyAPIServer.js +11 -6
- package/package.json +3 -2
|
@@ -26,619 +26,727 @@ class CommandSchemaRegistry {
|
|
|
26
26
|
}
|
|
27
27
|
initializeBuiltInCommands() {
|
|
28
28
|
this.registerCommand({
|
|
29
|
-
name:
|
|
30
|
-
aliases: [
|
|
31
|
-
description:
|
|
32
|
-
usage:
|
|
29
|
+
name: "help",
|
|
30
|
+
aliases: ["h"],
|
|
31
|
+
description: "Show help information for commands",
|
|
32
|
+
usage: "cdp help [command]",
|
|
33
33
|
examples: [
|
|
34
|
-
{ command:
|
|
35
|
-
{ command:
|
|
34
|
+
{ command: "cdp help", description: "Show general help" },
|
|
35
|
+
{ command: "cdp help eval", description: "Show help for eval command" },
|
|
36
36
|
],
|
|
37
37
|
options: [],
|
|
38
38
|
arguments: [
|
|
39
39
|
{
|
|
40
|
-
name:
|
|
41
|
-
description:
|
|
42
|
-
type:
|
|
43
|
-
required: false
|
|
44
|
-
}
|
|
45
|
-
]
|
|
40
|
+
name: "command",
|
|
41
|
+
description: "Command to show help for",
|
|
42
|
+
type: "string",
|
|
43
|
+
required: false,
|
|
44
|
+
},
|
|
45
|
+
],
|
|
46
46
|
});
|
|
47
47
|
this.registerCommand({
|
|
48
|
-
name:
|
|
49
|
-
aliases: [
|
|
50
|
-
description:
|
|
51
|
-
usage:
|
|
48
|
+
name: "version",
|
|
49
|
+
aliases: ["v"],
|
|
50
|
+
description: "Show version information",
|
|
51
|
+
usage: "cdp version",
|
|
52
52
|
examples: [
|
|
53
|
-
{ command:
|
|
53
|
+
{ command: "cdp version", description: "Display version number" },
|
|
54
54
|
],
|
|
55
55
|
options: [],
|
|
56
|
-
arguments: []
|
|
56
|
+
arguments: [],
|
|
57
57
|
});
|
|
58
58
|
this.registerCommand({
|
|
59
|
-
name:
|
|
60
|
-
aliases: [
|
|
61
|
-
description:
|
|
62
|
-
usage:
|
|
59
|
+
name: "eval",
|
|
60
|
+
aliases: ["js", "execute"],
|
|
61
|
+
description: "Execute JavaScript code in the browser",
|
|
62
|
+
usage: "cdp [global-options] eval [options] <expression>",
|
|
63
63
|
examples: [
|
|
64
|
-
{ command: '
|
|
65
|
-
{
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
{
|
|
64
|
+
{ command: 'cdp eval "document.title"', description: "Get page title" },
|
|
65
|
+
{
|
|
66
|
+
command: "cdp eval --file script.js",
|
|
67
|
+
description: "Execute JavaScript file",
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
command: 'cdp --format json eval "performance.timing"',
|
|
71
|
+
description: "Get performance data as JSON",
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
command: "cdp --verbose eval \"console.log('Debug info')\"",
|
|
75
|
+
description: "Execute with verbose logging",
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
command: 'cdp --config ~/.cdp.yaml eval "document.readyState"',
|
|
79
|
+
description: "Use custom configuration",
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
command: 'cdp eval --no-await-promise "Promise.resolve(42)"',
|
|
83
|
+
description: "Execute without awaiting promises",
|
|
84
|
+
},
|
|
70
85
|
],
|
|
71
86
|
options: [
|
|
72
87
|
{
|
|
73
|
-
name:
|
|
74
|
-
short:
|
|
75
|
-
description:
|
|
76
|
-
type:
|
|
77
|
-
required: false
|
|
88
|
+
name: "expression",
|
|
89
|
+
short: "e",
|
|
90
|
+
description: "JavaScript expression to execute",
|
|
91
|
+
type: "string",
|
|
92
|
+
required: false,
|
|
78
93
|
},
|
|
79
94
|
{
|
|
80
|
-
name:
|
|
81
|
-
short:
|
|
82
|
-
description:
|
|
83
|
-
type:
|
|
84
|
-
required: false
|
|
95
|
+
name: "file",
|
|
96
|
+
short: "f",
|
|
97
|
+
description: "JavaScript file to execute",
|
|
98
|
+
type: "string",
|
|
99
|
+
required: false,
|
|
85
100
|
},
|
|
86
101
|
{
|
|
87
|
-
name:
|
|
88
|
-
description:
|
|
89
|
-
type:
|
|
90
|
-
default: true
|
|
102
|
+
name: "await-promise",
|
|
103
|
+
description: "Await promise results",
|
|
104
|
+
type: "boolean",
|
|
105
|
+
default: true,
|
|
91
106
|
},
|
|
92
107
|
{
|
|
93
|
-
name:
|
|
94
|
-
description:
|
|
95
|
-
type:
|
|
96
|
-
default: true
|
|
97
|
-
}
|
|
108
|
+
name: "return-by-value",
|
|
109
|
+
description: "Return result by value instead of object reference",
|
|
110
|
+
type: "boolean",
|
|
111
|
+
default: true,
|
|
112
|
+
},
|
|
98
113
|
],
|
|
99
114
|
arguments: [
|
|
100
115
|
{
|
|
101
|
-
name:
|
|
102
|
-
description:
|
|
103
|
-
type:
|
|
104
|
-
required: false
|
|
105
|
-
}
|
|
106
|
-
]
|
|
116
|
+
name: "expression",
|
|
117
|
+
description: "JavaScript expression to execute (alternative to --expression)",
|
|
118
|
+
type: "string",
|
|
119
|
+
required: false,
|
|
120
|
+
},
|
|
121
|
+
],
|
|
107
122
|
});
|
|
108
123
|
this.registerCommand({
|
|
109
|
-
name:
|
|
110
|
-
aliases: [
|
|
111
|
-
description:
|
|
112
|
-
usage:
|
|
124
|
+
name: "screenshot",
|
|
125
|
+
aliases: ["ss", "capture"],
|
|
126
|
+
description: "Capture page screenshot",
|
|
127
|
+
usage: "cdp [global-options] screenshot [options]",
|
|
113
128
|
examples: [
|
|
114
|
-
{ command:
|
|
115
|
-
{
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
{
|
|
129
|
+
{ command: "cdp screenshot", description: "Take basic screenshot" },
|
|
130
|
+
{
|
|
131
|
+
command: "cdp screenshot --filename page.png --full-page",
|
|
132
|
+
description: "Full page screenshot",
|
|
133
|
+
},
|
|
134
|
+
{
|
|
135
|
+
command: "cdp --quiet screenshot --filename result.png",
|
|
136
|
+
description: "Silent screenshot capture",
|
|
137
|
+
},
|
|
138
|
+
{
|
|
139
|
+
command: "cdp --profile production screenshot --format jpeg --quality 90",
|
|
140
|
+
description: "Production screenshot with custom quality",
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
command: "cdp screenshot --width 800 --height 600 --format jpeg --quality 90",
|
|
144
|
+
description: "Custom size and quality",
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
command: "cdp screenshot --clip-x 100 --clip-y 100 --clip-width 400 --clip-height 300",
|
|
148
|
+
description: "Screenshot specific region",
|
|
149
|
+
},
|
|
120
150
|
],
|
|
121
151
|
options: [
|
|
122
152
|
{
|
|
123
|
-
name:
|
|
124
|
-
short:
|
|
125
|
-
description:
|
|
126
|
-
type:
|
|
153
|
+
name: "filename",
|
|
154
|
+
short: "o",
|
|
155
|
+
description: "Output filename",
|
|
156
|
+
type: "string",
|
|
127
157
|
},
|
|
128
158
|
{
|
|
129
|
-
name:
|
|
130
|
-
short:
|
|
131
|
-
description:
|
|
132
|
-
type:
|
|
159
|
+
name: "width",
|
|
160
|
+
short: "w",
|
|
161
|
+
description: "Viewport width",
|
|
162
|
+
type: "number",
|
|
133
163
|
},
|
|
134
164
|
{
|
|
135
|
-
name:
|
|
136
|
-
short:
|
|
137
|
-
description:
|
|
138
|
-
type:
|
|
165
|
+
name: "height",
|
|
166
|
+
short: "h",
|
|
167
|
+
description: "Viewport height",
|
|
168
|
+
type: "number",
|
|
139
169
|
},
|
|
140
170
|
{
|
|
141
|
-
name:
|
|
142
|
-
description:
|
|
143
|
-
type:
|
|
144
|
-
choices: [
|
|
145
|
-
default:
|
|
171
|
+
name: "image-format",
|
|
172
|
+
description: "Image encoding format",
|
|
173
|
+
type: "string",
|
|
174
|
+
choices: ["png", "jpeg", "webp"],
|
|
175
|
+
default: "png",
|
|
146
176
|
},
|
|
147
177
|
{
|
|
148
|
-
name:
|
|
149
|
-
description:
|
|
150
|
-
type:
|
|
178
|
+
name: "quality",
|
|
179
|
+
description: "Image quality (0-100, JPEG/WebP only)",
|
|
180
|
+
type: "number",
|
|
151
181
|
},
|
|
152
182
|
{
|
|
153
|
-
name:
|
|
154
|
-
description:
|
|
155
|
-
type:
|
|
156
|
-
default: false
|
|
183
|
+
name: "full-page",
|
|
184
|
+
description: "Capture full page",
|
|
185
|
+
type: "boolean",
|
|
186
|
+
default: false,
|
|
157
187
|
},
|
|
158
188
|
{
|
|
159
|
-
name:
|
|
160
|
-
description:
|
|
161
|
-
type:
|
|
189
|
+
name: "clip-x",
|
|
190
|
+
description: "Clip rectangle X coordinate",
|
|
191
|
+
type: "number",
|
|
162
192
|
},
|
|
163
193
|
{
|
|
164
|
-
name:
|
|
165
|
-
description:
|
|
166
|
-
type:
|
|
194
|
+
name: "clip-y",
|
|
195
|
+
description: "Clip rectangle Y coordinate",
|
|
196
|
+
type: "number",
|
|
167
197
|
},
|
|
168
198
|
{
|
|
169
|
-
name:
|
|
170
|
-
description:
|
|
171
|
-
type:
|
|
199
|
+
name: "clip-width",
|
|
200
|
+
description: "Clip rectangle width",
|
|
201
|
+
type: "number",
|
|
172
202
|
},
|
|
173
203
|
{
|
|
174
|
-
name:
|
|
175
|
-
description:
|
|
176
|
-
type:
|
|
204
|
+
name: "clip-height",
|
|
205
|
+
description: "Clip rectangle height",
|
|
206
|
+
type: "number",
|
|
177
207
|
},
|
|
178
208
|
{
|
|
179
|
-
name:
|
|
180
|
-
description:
|
|
181
|
-
type:
|
|
182
|
-
default: 1
|
|
183
|
-
}
|
|
209
|
+
name: "clip-scale",
|
|
210
|
+
description: "Clip rectangle scale",
|
|
211
|
+
type: "number",
|
|
212
|
+
default: 1,
|
|
213
|
+
},
|
|
184
214
|
],
|
|
185
|
-
arguments: []
|
|
215
|
+
arguments: [],
|
|
186
216
|
});
|
|
187
217
|
this.registerCommand({
|
|
188
|
-
name:
|
|
218
|
+
name: "click",
|
|
189
219
|
aliases: [],
|
|
190
|
-
description:
|
|
191
|
-
usage:
|
|
220
|
+
description: "Click on an element",
|
|
221
|
+
usage: "cdp [global-options] click [options] <selector>",
|
|
192
222
|
examples: [
|
|
193
|
-
{
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
223
|
+
{
|
|
224
|
+
command: 'cdp click "#submit-button"',
|
|
225
|
+
description: "Click element by ID",
|
|
226
|
+
},
|
|
227
|
+
{
|
|
228
|
+
command: 'cdp click ".nav-link:first-child"',
|
|
229
|
+
description: "Click first navigation link",
|
|
230
|
+
},
|
|
231
|
+
{
|
|
232
|
+
command: 'cdp --timeout 10000 click ".slow-loading-button"',
|
|
233
|
+
description: "Click with extended timeout",
|
|
234
|
+
},
|
|
235
|
+
{
|
|
236
|
+
command: 'cdp --verbose click "[data-testid=checkout]"',
|
|
237
|
+
description: "Click with verbose logging",
|
|
238
|
+
},
|
|
197
239
|
],
|
|
198
240
|
options: [],
|
|
199
241
|
arguments: [
|
|
200
242
|
{
|
|
201
|
-
name:
|
|
202
|
-
description:
|
|
203
|
-
type:
|
|
204
|
-
required: true
|
|
205
|
-
}
|
|
206
|
-
]
|
|
243
|
+
name: "selector",
|
|
244
|
+
description: "CSS selector for element to click",
|
|
245
|
+
type: "string",
|
|
246
|
+
required: true,
|
|
247
|
+
},
|
|
248
|
+
],
|
|
207
249
|
});
|
|
208
250
|
this.registerCommand({
|
|
209
|
-
name:
|
|
210
|
-
aliases: [
|
|
211
|
-
description:
|
|
212
|
-
usage:
|
|
251
|
+
name: "fill",
|
|
252
|
+
aliases: ["type"],
|
|
253
|
+
description: "Fill a form field with text",
|
|
254
|
+
usage: "cdp [global-options] fill [options] <selector> <text>",
|
|
213
255
|
examples: [
|
|
214
|
-
{
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
256
|
+
{
|
|
257
|
+
command: 'cdp fill "#username" "john@example.com"',
|
|
258
|
+
description: "Fill username field",
|
|
259
|
+
},
|
|
260
|
+
{
|
|
261
|
+
command: 'cdp fill "input[name=password]" "secret123"',
|
|
262
|
+
description: "Fill password field",
|
|
263
|
+
},
|
|
264
|
+
{
|
|
265
|
+
command: 'cdp fill "#country" "United States"',
|
|
266
|
+
description: "Select dropdown option by text",
|
|
267
|
+
},
|
|
268
|
+
{
|
|
269
|
+
command: 'cdp --debug fill "#notes" "Additional information"',
|
|
270
|
+
description: "Fill with debug logging",
|
|
271
|
+
},
|
|
218
272
|
],
|
|
219
273
|
options: [],
|
|
220
274
|
arguments: [
|
|
221
275
|
{
|
|
222
|
-
name:
|
|
223
|
-
description:
|
|
224
|
-
type:
|
|
225
|
-
required: true
|
|
276
|
+
name: "selector",
|
|
277
|
+
description: "CSS selector for form field",
|
|
278
|
+
type: "string",
|
|
279
|
+
required: true,
|
|
226
280
|
},
|
|
227
281
|
{
|
|
228
|
-
name:
|
|
229
|
-
description:
|
|
230
|
-
type:
|
|
231
|
-
required: true
|
|
232
|
-
}
|
|
233
|
-
]
|
|
282
|
+
name: "text",
|
|
283
|
+
description: "Text to fill in the field",
|
|
284
|
+
type: "string",
|
|
285
|
+
required: true,
|
|
286
|
+
},
|
|
287
|
+
],
|
|
234
288
|
});
|
|
235
289
|
this.registerCommand({
|
|
236
|
-
name:
|
|
290
|
+
name: "fill_form",
|
|
237
291
|
aliases: [],
|
|
238
|
-
description:
|
|
239
|
-
usage:
|
|
292
|
+
description: "Fill multiple form fields in batch",
|
|
293
|
+
usage: "cdp [global-options] fill_form [options]",
|
|
240
294
|
examples: [
|
|
241
|
-
{
|
|
242
|
-
|
|
243
|
-
|
|
295
|
+
{
|
|
296
|
+
command: 'cdp fill_form --fields \'[{"selector":"#name","value":"John"},{"selector":"#email","value":"john@example.com"}]\'',
|
|
297
|
+
description: "Fill multiple fields",
|
|
298
|
+
},
|
|
299
|
+
{
|
|
300
|
+
command: "cdp fill_form --fields-file form-data.json",
|
|
301
|
+
description: "Fill form from JSON file",
|
|
302
|
+
},
|
|
303
|
+
{
|
|
304
|
+
command: 'cdp --quiet fill_form --fields \'[{"selector":"#username","value":"testuser"}]\' --stop-on-error',
|
|
305
|
+
description: "Silent batch fill with error handling",
|
|
306
|
+
},
|
|
244
307
|
],
|
|
245
308
|
options: [
|
|
246
309
|
{
|
|
247
|
-
name:
|
|
248
|
-
description:
|
|
249
|
-
type:
|
|
250
|
-
required: true
|
|
251
|
-
}
|
|
310
|
+
name: "fields",
|
|
311
|
+
description: "JSON array of field objects with selector and value",
|
|
312
|
+
type: "string",
|
|
313
|
+
required: true,
|
|
314
|
+
},
|
|
252
315
|
],
|
|
253
|
-
arguments: []
|
|
316
|
+
arguments: [],
|
|
254
317
|
});
|
|
255
318
|
this.registerCommand({
|
|
256
|
-
name:
|
|
257
|
-
aliases: [
|
|
258
|
-
description:
|
|
259
|
-
usage:
|
|
319
|
+
name: "hover",
|
|
320
|
+
aliases: ["mouseover"],
|
|
321
|
+
description: "Hover over an element",
|
|
322
|
+
usage: "cdp hover <selector>",
|
|
260
323
|
examples: [
|
|
261
|
-
{
|
|
324
|
+
{
|
|
325
|
+
command: 'cdp hover ".dropdown-trigger"',
|
|
326
|
+
description: "Hover over dropdown trigger",
|
|
327
|
+
},
|
|
262
328
|
],
|
|
263
329
|
options: [],
|
|
264
330
|
arguments: [
|
|
265
331
|
{
|
|
266
|
-
name:
|
|
267
|
-
description:
|
|
268
|
-
type:
|
|
269
|
-
required: true
|
|
270
|
-
}
|
|
271
|
-
]
|
|
332
|
+
name: "selector",
|
|
333
|
+
description: "CSS selector for element to hover over",
|
|
334
|
+
type: "string",
|
|
335
|
+
required: true,
|
|
336
|
+
},
|
|
337
|
+
],
|
|
272
338
|
});
|
|
273
339
|
this.registerCommand({
|
|
274
|
-
name:
|
|
340
|
+
name: "drag",
|
|
275
341
|
aliases: [],
|
|
276
|
-
description:
|
|
277
|
-
usage:
|
|
342
|
+
description: "Perform drag and drop operations",
|
|
343
|
+
usage: "cdp drag <fromSelector> <toSelector>",
|
|
278
344
|
examples: [
|
|
279
|
-
{
|
|
345
|
+
{
|
|
346
|
+
command: 'cdp drag "#item1" "#dropzone"',
|
|
347
|
+
description: "Drag item1 to dropzone",
|
|
348
|
+
},
|
|
280
349
|
],
|
|
281
350
|
options: [],
|
|
282
351
|
arguments: [
|
|
283
352
|
{
|
|
284
|
-
name:
|
|
285
|
-
description:
|
|
286
|
-
type:
|
|
287
|
-
required: true
|
|
353
|
+
name: "sourceSelector",
|
|
354
|
+
description: "CSS selector for element to drag from",
|
|
355
|
+
type: "string",
|
|
356
|
+
required: true,
|
|
288
357
|
},
|
|
289
358
|
{
|
|
290
|
-
name:
|
|
291
|
-
description:
|
|
292
|
-
type:
|
|
293
|
-
required: true
|
|
294
|
-
}
|
|
295
|
-
]
|
|
359
|
+
name: "targetSelector",
|
|
360
|
+
description: "CSS selector for element to drag to",
|
|
361
|
+
type: "string",
|
|
362
|
+
required: true,
|
|
363
|
+
},
|
|
364
|
+
],
|
|
296
365
|
});
|
|
297
366
|
this.registerCommand({
|
|
298
|
-
name:
|
|
367
|
+
name: "press_key",
|
|
299
368
|
aliases: [],
|
|
300
|
-
description:
|
|
301
|
-
usage:
|
|
369
|
+
description: "Simulate keyboard input with modifiers",
|
|
370
|
+
usage: "cdp press_key <key> [options]",
|
|
302
371
|
examples: [
|
|
303
|
-
{ command: '
|
|
304
|
-
{
|
|
372
|
+
{ command: 'cdp press_key "Enter"', description: "Press Enter key" },
|
|
373
|
+
{
|
|
374
|
+
command: 'cdp press_key "s" --modifiers ctrl',
|
|
375
|
+
description: "Press Ctrl+S",
|
|
376
|
+
},
|
|
305
377
|
],
|
|
306
378
|
options: [
|
|
307
379
|
{
|
|
308
|
-
name:
|
|
309
|
-
description:
|
|
310
|
-
type:
|
|
311
|
-
}
|
|
380
|
+
name: "modifiers",
|
|
381
|
+
description: "Key modifiers (ctrl, alt, shift, meta)",
|
|
382
|
+
type: "string",
|
|
383
|
+
},
|
|
312
384
|
],
|
|
313
385
|
arguments: [
|
|
314
386
|
{
|
|
315
|
-
name:
|
|
316
|
-
description:
|
|
317
|
-
type:
|
|
318
|
-
required: true
|
|
319
|
-
}
|
|
320
|
-
]
|
|
387
|
+
name: "key",
|
|
388
|
+
description: "Key to press",
|
|
389
|
+
type: "string",
|
|
390
|
+
required: true,
|
|
391
|
+
},
|
|
392
|
+
],
|
|
321
393
|
});
|
|
322
394
|
this.registerCommand({
|
|
323
|
-
name:
|
|
395
|
+
name: "upload_file",
|
|
324
396
|
aliases: [],
|
|
325
|
-
description:
|
|
326
|
-
usage:
|
|
397
|
+
description: "Upload files to file input elements",
|
|
398
|
+
usage: "cdp upload_file <selector> <filePath>",
|
|
327
399
|
examples: [
|
|
328
|
-
{
|
|
400
|
+
{
|
|
401
|
+
command: 'cdp upload_file "input[type=file]" "/path/to/file.txt"',
|
|
402
|
+
description: "Upload file to input",
|
|
403
|
+
},
|
|
329
404
|
],
|
|
330
405
|
options: [],
|
|
331
406
|
arguments: [
|
|
332
407
|
{
|
|
333
|
-
name:
|
|
334
|
-
description:
|
|
335
|
-
type:
|
|
336
|
-
required: true
|
|
408
|
+
name: "selector",
|
|
409
|
+
description: "CSS selector for file input element",
|
|
410
|
+
type: "string",
|
|
411
|
+
required: true,
|
|
337
412
|
},
|
|
338
413
|
{
|
|
339
|
-
name:
|
|
340
|
-
description:
|
|
341
|
-
type:
|
|
342
|
-
required: true
|
|
343
|
-
}
|
|
344
|
-
]
|
|
414
|
+
name: "filePath",
|
|
415
|
+
description: "Path to file to upload",
|
|
416
|
+
type: "file",
|
|
417
|
+
required: true,
|
|
418
|
+
},
|
|
419
|
+
],
|
|
345
420
|
});
|
|
346
421
|
this.registerCommand({
|
|
347
|
-
name:
|
|
422
|
+
name: "wait_for",
|
|
348
423
|
aliases: [],
|
|
349
|
-
description:
|
|
350
|
-
usage:
|
|
424
|
+
description: "Wait for elements to appear or meet conditions",
|
|
425
|
+
usage: "cdp wait_for <selector> [options]",
|
|
351
426
|
examples: [
|
|
352
|
-
{
|
|
353
|
-
|
|
427
|
+
{
|
|
428
|
+
command: 'cdp wait_for "#loading"',
|
|
429
|
+
description: "Wait for loading element to appear",
|
|
430
|
+
},
|
|
431
|
+
{
|
|
432
|
+
command: 'cdp wait_for ".content" --timeout 10000',
|
|
433
|
+
description: "Wait up to 10 seconds",
|
|
434
|
+
},
|
|
354
435
|
],
|
|
355
436
|
options: [
|
|
356
437
|
{
|
|
357
|
-
name:
|
|
358
|
-
description:
|
|
359
|
-
type:
|
|
360
|
-
default: 30000
|
|
361
|
-
}
|
|
438
|
+
name: "timeout",
|
|
439
|
+
description: "Maximum wait time in milliseconds",
|
|
440
|
+
type: "number",
|
|
441
|
+
default: 30000,
|
|
442
|
+
},
|
|
362
443
|
],
|
|
363
444
|
arguments: [
|
|
364
445
|
{
|
|
365
|
-
name:
|
|
366
|
-
description:
|
|
367
|
-
type:
|
|
368
|
-
required: true
|
|
369
|
-
}
|
|
370
|
-
]
|
|
446
|
+
name: "selector",
|
|
447
|
+
description: "CSS selector for element to wait for",
|
|
448
|
+
type: "string",
|
|
449
|
+
required: true,
|
|
450
|
+
},
|
|
451
|
+
],
|
|
371
452
|
});
|
|
372
453
|
this.registerCommand({
|
|
373
|
-
name:
|
|
454
|
+
name: "handle_dialog",
|
|
374
455
|
aliases: [],
|
|
375
|
-
description:
|
|
376
|
-
usage:
|
|
456
|
+
description: "Handle browser dialogs (alert, confirm, prompt)",
|
|
457
|
+
usage: "cdp handle_dialog <action> [options]",
|
|
377
458
|
examples: [
|
|
378
|
-
{ command:
|
|
379
|
-
{ command:
|
|
380
|
-
{
|
|
459
|
+
{ command: "cdp handle_dialog accept", description: "Accept dialog" },
|
|
460
|
+
{ command: "cdp handle_dialog dismiss", description: "Dismiss dialog" },
|
|
461
|
+
{
|
|
462
|
+
command: 'cdp handle_dialog accept --text "Hello"',
|
|
463
|
+
description: "Accept prompt with text",
|
|
464
|
+
},
|
|
381
465
|
],
|
|
382
466
|
options: [
|
|
383
467
|
{
|
|
384
|
-
name:
|
|
385
|
-
description:
|
|
386
|
-
type:
|
|
387
|
-
}
|
|
468
|
+
name: "text",
|
|
469
|
+
description: "Text to enter in prompt dialog",
|
|
470
|
+
type: "string",
|
|
471
|
+
},
|
|
388
472
|
],
|
|
389
473
|
arguments: [
|
|
390
474
|
{
|
|
391
|
-
name:
|
|
392
|
-
description:
|
|
393
|
-
type:
|
|
394
|
-
required: true
|
|
395
|
-
}
|
|
396
|
-
]
|
|
475
|
+
name: "action",
|
|
476
|
+
description: "Action to take (accept, dismiss)",
|
|
477
|
+
type: "string",
|
|
478
|
+
required: true,
|
|
479
|
+
},
|
|
480
|
+
],
|
|
397
481
|
});
|
|
398
482
|
this.registerCommand({
|
|
399
|
-
name:
|
|
400
|
-
aliases: [
|
|
401
|
-
description:
|
|
402
|
-
usage:
|
|
483
|
+
name: "navigate",
|
|
484
|
+
aliases: ["goto", "open"],
|
|
485
|
+
description: "Navigate to a URL",
|
|
486
|
+
usage: "cdp navigate <url>",
|
|
403
487
|
examples: [
|
|
404
|
-
{
|
|
488
|
+
{
|
|
489
|
+
command: 'cdp navigate "https://example.com"',
|
|
490
|
+
description: "Navigate to example.com",
|
|
491
|
+
},
|
|
405
492
|
],
|
|
406
493
|
options: [],
|
|
407
494
|
arguments: [
|
|
408
495
|
{
|
|
409
|
-
name:
|
|
410
|
-
description:
|
|
411
|
-
type:
|
|
412
|
-
required: true
|
|
413
|
-
}
|
|
414
|
-
]
|
|
496
|
+
name: "url",
|
|
497
|
+
description: "URL to navigate to",
|
|
498
|
+
type: "url",
|
|
499
|
+
required: true,
|
|
500
|
+
},
|
|
501
|
+
],
|
|
415
502
|
});
|
|
416
503
|
this.registerCommand({
|
|
417
|
-
name:
|
|
418
|
-
aliases: [
|
|
419
|
-
description:
|
|
420
|
-
usage:
|
|
504
|
+
name: "dom",
|
|
505
|
+
aliases: ["snapshot"],
|
|
506
|
+
description: "Capture DOM snapshot",
|
|
507
|
+
usage: "cdp dom [options]",
|
|
421
508
|
examples: [
|
|
422
|
-
{ command:
|
|
423
|
-
{
|
|
509
|
+
{ command: "cdp dom", description: "Basic DOM snapshot" },
|
|
510
|
+
{
|
|
511
|
+
command: "cdp dom --format html --filename dom.html",
|
|
512
|
+
description: "Save as HTML file",
|
|
513
|
+
},
|
|
424
514
|
],
|
|
425
515
|
options: [
|
|
426
516
|
{
|
|
427
|
-
name:
|
|
428
|
-
short:
|
|
429
|
-
description:
|
|
430
|
-
type:
|
|
517
|
+
name: "filename",
|
|
518
|
+
short: "o",
|
|
519
|
+
description: "Output filename",
|
|
520
|
+
type: "string",
|
|
431
521
|
},
|
|
432
522
|
{
|
|
433
|
-
name:
|
|
434
|
-
description:
|
|
435
|
-
type:
|
|
436
|
-
choices: [
|
|
437
|
-
default:
|
|
523
|
+
name: "format",
|
|
524
|
+
description: "Output format",
|
|
525
|
+
type: "string",
|
|
526
|
+
choices: ["text", "html", "json"],
|
|
527
|
+
default: "text",
|
|
438
528
|
},
|
|
439
529
|
{
|
|
440
|
-
name:
|
|
441
|
-
description:
|
|
442
|
-
type:
|
|
443
|
-
default: true
|
|
530
|
+
name: "include-styles",
|
|
531
|
+
description: "Include computed styles",
|
|
532
|
+
type: "boolean",
|
|
533
|
+
default: true,
|
|
444
534
|
},
|
|
445
535
|
{
|
|
446
|
-
name:
|
|
447
|
-
description:
|
|
448
|
-
type:
|
|
449
|
-
default: true
|
|
536
|
+
name: "include-attributes",
|
|
537
|
+
description: "Include element attributes",
|
|
538
|
+
type: "boolean",
|
|
539
|
+
default: true,
|
|
450
540
|
},
|
|
451
541
|
{
|
|
452
|
-
name:
|
|
453
|
-
description:
|
|
454
|
-
type:
|
|
455
|
-
default: false
|
|
542
|
+
name: "include-paint-order",
|
|
543
|
+
description: "Include paint order information",
|
|
544
|
+
type: "boolean",
|
|
545
|
+
default: false,
|
|
456
546
|
},
|
|
457
547
|
{
|
|
458
|
-
name:
|
|
459
|
-
description:
|
|
460
|
-
type:
|
|
461
|
-
default: false
|
|
548
|
+
name: "include-text-index",
|
|
549
|
+
description: "Include text index information",
|
|
550
|
+
type: "boolean",
|
|
551
|
+
default: false,
|
|
462
552
|
},
|
|
463
553
|
{
|
|
464
|
-
name:
|
|
465
|
-
description:
|
|
466
|
-
type:
|
|
554
|
+
name: "color",
|
|
555
|
+
description: "Enable color output (default: auto-detect)",
|
|
556
|
+
type: "boolean",
|
|
467
557
|
},
|
|
468
558
|
{
|
|
469
|
-
name:
|
|
470
|
-
description:
|
|
471
|
-
type:
|
|
472
|
-
default: false
|
|
473
|
-
}
|
|
559
|
+
name: "no-color",
|
|
560
|
+
description: "Disable color output",
|
|
561
|
+
type: "boolean",
|
|
562
|
+
default: false,
|
|
563
|
+
},
|
|
474
564
|
],
|
|
475
|
-
arguments: []
|
|
565
|
+
arguments: [],
|
|
476
566
|
});
|
|
477
567
|
this.registerCommand({
|
|
478
|
-
name:
|
|
479
|
-
aliases: [],
|
|
480
|
-
description:
|
|
481
|
-
usage:
|
|
568
|
+
name: "log",
|
|
569
|
+
aliases: ["console"],
|
|
570
|
+
description: "Follow console messages in real-time",
|
|
571
|
+
usage: "cdp log [options]",
|
|
482
572
|
examples: [
|
|
483
|
-
{ command:
|
|
484
|
-
{ command: 'chrome-cdp-cli console --latest', description: 'Get the latest console message' },
|
|
485
|
-
{ command: 'chrome-cdp-cli console --types error,warn', description: 'Get only error and warning messages' }
|
|
486
|
-
],
|
|
487
|
-
options: [
|
|
573
|
+
{ command: "cdp log", description: "Follow all console messages" },
|
|
488
574
|
{
|
|
489
|
-
|
|
490
|
-
description:
|
|
491
|
-
type: 'boolean'
|
|
575
|
+
command: "cdp log --types error,warn",
|
|
576
|
+
description: "Follow only errors and warnings",
|
|
492
577
|
},
|
|
493
578
|
{
|
|
494
|
-
|
|
495
|
-
description:
|
|
496
|
-
type: 'string'
|
|
579
|
+
command: 'cdp log --textPattern "API"',
|
|
580
|
+
description: "Follow messages matching /API/i",
|
|
497
581
|
},
|
|
498
582
|
{
|
|
499
|
-
|
|
500
|
-
description:
|
|
501
|
-
type: 'string'
|
|
583
|
+
command: "cdp log --format json",
|
|
584
|
+
description: "Output as JSON (one object per line)",
|
|
502
585
|
},
|
|
586
|
+
{ command: "cdp log --format pretty", description: "Colorized output" },
|
|
587
|
+
],
|
|
588
|
+
options: [
|
|
503
589
|
{
|
|
504
|
-
name:
|
|
505
|
-
description:
|
|
506
|
-
type:
|
|
590
|
+
name: "types",
|
|
591
|
+
description: "Filter by message types (comma-separated: log,info,warn,error,debug)",
|
|
592
|
+
type: "string",
|
|
507
593
|
},
|
|
508
594
|
{
|
|
509
|
-
name:
|
|
510
|
-
description:
|
|
511
|
-
type:
|
|
595
|
+
name: "textPattern",
|
|
596
|
+
description: "Filter by text pattern (regex, case-insensitive)",
|
|
597
|
+
type: "string",
|
|
512
598
|
},
|
|
513
599
|
{
|
|
514
|
-
name:
|
|
515
|
-
|
|
516
|
-
|
|
600
|
+
name: "follow",
|
|
601
|
+
short: "f",
|
|
602
|
+
description: "Alias flag — follow mode is always active",
|
|
603
|
+
type: "boolean",
|
|
517
604
|
},
|
|
518
605
|
{
|
|
519
|
-
name:
|
|
520
|
-
description:
|
|
521
|
-
type:
|
|
522
|
-
|
|
606
|
+
name: "format",
|
|
607
|
+
description: "Output format: text, json, or pretty (default: text)",
|
|
608
|
+
type: "string",
|
|
609
|
+
choices: ["text", "json", "pretty"],
|
|
610
|
+
},
|
|
523
611
|
],
|
|
524
|
-
arguments: []
|
|
612
|
+
arguments: [],
|
|
525
613
|
});
|
|
526
614
|
this.registerCommand({
|
|
527
|
-
name:
|
|
615
|
+
name: "network",
|
|
528
616
|
aliases: [],
|
|
529
|
-
description:
|
|
530
|
-
usage:
|
|
617
|
+
description: "Follow network requests in real-time",
|
|
618
|
+
usage: "cdp network [options]",
|
|
531
619
|
examples: [
|
|
532
|
-
{ command:
|
|
533
|
-
{
|
|
534
|
-
|
|
620
|
+
{ command: "cdp network", description: "Follow all network requests" },
|
|
621
|
+
{
|
|
622
|
+
command: "cdp network --methods POST,PUT",
|
|
623
|
+
description: "Follow only POST and PUT requests",
|
|
624
|
+
},
|
|
625
|
+
{
|
|
626
|
+
command: 'cdp network --urlPattern "/api/"',
|
|
627
|
+
description: "Follow requests matching URL pattern",
|
|
628
|
+
},
|
|
629
|
+
{
|
|
630
|
+
command: "cdp network --statusCodes 404,500",
|
|
631
|
+
description: "Follow requests with error status",
|
|
632
|
+
},
|
|
633
|
+
{ command: "cdp network --format json", description: "Output as JSON" },
|
|
535
634
|
],
|
|
536
635
|
options: [
|
|
537
636
|
{
|
|
538
|
-
name:
|
|
539
|
-
description:
|
|
540
|
-
type:
|
|
637
|
+
name: "methods",
|
|
638
|
+
description: "Filter by HTTP methods (comma-separated: GET,POST,PUT,DELETE,...)",
|
|
639
|
+
type: "string",
|
|
640
|
+
},
|
|
641
|
+
{
|
|
642
|
+
name: "urlPattern",
|
|
643
|
+
description: "Filter by URL pattern (regex, case-insensitive)",
|
|
644
|
+
type: "string",
|
|
541
645
|
},
|
|
542
646
|
{
|
|
543
|
-
name:
|
|
544
|
-
description:
|
|
545
|
-
type:
|
|
546
|
-
}
|
|
647
|
+
name: "statusCodes",
|
|
648
|
+
description: "Filter by HTTP status codes (comma-separated: 200,404,500)",
|
|
649
|
+
type: "string",
|
|
650
|
+
},
|
|
651
|
+
{
|
|
652
|
+
name: "follow",
|
|
653
|
+
short: "f",
|
|
654
|
+
description: "Alias flag — follow mode is always active",
|
|
655
|
+
type: "boolean",
|
|
656
|
+
},
|
|
657
|
+
{
|
|
658
|
+
name: "format",
|
|
659
|
+
description: "Output format: text, json, or pretty (default: text)",
|
|
660
|
+
type: "string",
|
|
661
|
+
choices: ["text", "json", "pretty"],
|
|
662
|
+
},
|
|
547
663
|
],
|
|
548
|
-
arguments: []
|
|
664
|
+
arguments: [],
|
|
549
665
|
});
|
|
550
666
|
this.registerCommand({
|
|
551
|
-
name:
|
|
552
|
-
aliases: [
|
|
553
|
-
description:
|
|
554
|
-
usage:
|
|
667
|
+
name: "install_cursor_command",
|
|
668
|
+
aliases: ["install-cursor"],
|
|
669
|
+
description: "Install Cursor IDE commands for Chrome automation",
|
|
670
|
+
usage: "cdp install_cursor_command [options]",
|
|
555
671
|
examples: [
|
|
556
|
-
{
|
|
557
|
-
|
|
672
|
+
{
|
|
673
|
+
command: "cdp install_cursor_command",
|
|
674
|
+
description: "Install with default settings",
|
|
675
|
+
},
|
|
676
|
+
{
|
|
677
|
+
command: "cdp install_cursor_command --target-directory ./commands --force",
|
|
678
|
+
description: "Install to custom directory",
|
|
679
|
+
},
|
|
558
680
|
],
|
|
559
681
|
options: [
|
|
560
682
|
{
|
|
561
|
-
name:
|
|
562
|
-
description:
|
|
563
|
-
type:
|
|
683
|
+
name: "target-directory",
|
|
684
|
+
description: "Target directory for installation",
|
|
685
|
+
type: "string",
|
|
564
686
|
},
|
|
565
687
|
{
|
|
566
|
-
name:
|
|
567
|
-
description:
|
|
568
|
-
type:
|
|
569
|
-
default: true
|
|
688
|
+
name: "include-examples",
|
|
689
|
+
description: "Include example files",
|
|
690
|
+
type: "boolean",
|
|
691
|
+
default: true,
|
|
570
692
|
},
|
|
571
693
|
{
|
|
572
|
-
name:
|
|
573
|
-
description:
|
|
574
|
-
type:
|
|
575
|
-
default: false
|
|
576
|
-
}
|
|
694
|
+
name: "force",
|
|
695
|
+
description: "Force overwrite existing files",
|
|
696
|
+
type: "boolean",
|
|
697
|
+
default: false,
|
|
698
|
+
},
|
|
577
699
|
],
|
|
578
|
-
arguments: []
|
|
700
|
+
arguments: [],
|
|
579
701
|
});
|
|
580
702
|
this.registerCommand({
|
|
581
|
-
name:
|
|
582
|
-
aliases: [
|
|
583
|
-
description:
|
|
584
|
-
usage:
|
|
703
|
+
name: "install_claude_skill",
|
|
704
|
+
aliases: ["install-claude"],
|
|
705
|
+
description: "Install Claude Code skill for Chrome automation",
|
|
706
|
+
usage: "cdp install_claude_skill [options]",
|
|
585
707
|
examples: [
|
|
586
|
-
{
|
|
587
|
-
|
|
708
|
+
{
|
|
709
|
+
command: "cdp install_claude_skill",
|
|
710
|
+
description: "Install with default settings",
|
|
711
|
+
},
|
|
712
|
+
{
|
|
713
|
+
command: "cdp install_claude_skill --skill-type browser --include-references",
|
|
714
|
+
description: "Install browser skill with references",
|
|
715
|
+
},
|
|
588
716
|
],
|
|
589
717
|
options: [
|
|
590
718
|
{
|
|
591
|
-
name:
|
|
592
|
-
description:
|
|
593
|
-
type:
|
|
594
|
-
choices: [
|
|
595
|
-
default:
|
|
719
|
+
name: "skill-type",
|
|
720
|
+
description: "Type of skill to install",
|
|
721
|
+
type: "string",
|
|
722
|
+
choices: ["browser", "automation", "testing"],
|
|
723
|
+
default: "browser",
|
|
596
724
|
},
|
|
597
725
|
{
|
|
598
|
-
name:
|
|
599
|
-
description:
|
|
600
|
-
type:
|
|
726
|
+
name: "target-directory",
|
|
727
|
+
description: "Target directory for installation",
|
|
728
|
+
type: "string",
|
|
601
729
|
},
|
|
602
730
|
{
|
|
603
|
-
name:
|
|
604
|
-
description:
|
|
605
|
-
type:
|
|
606
|
-
default: true
|
|
731
|
+
name: "include-examples",
|
|
732
|
+
description: "Include example files",
|
|
733
|
+
type: "boolean",
|
|
734
|
+
default: true,
|
|
607
735
|
},
|
|
608
736
|
{
|
|
609
|
-
name:
|
|
610
|
-
description:
|
|
611
|
-
type:
|
|
612
|
-
default: true
|
|
737
|
+
name: "include-references",
|
|
738
|
+
description: "Include reference documentation",
|
|
739
|
+
type: "boolean",
|
|
740
|
+
default: true,
|
|
613
741
|
},
|
|
614
742
|
{
|
|
615
|
-
name:
|
|
616
|
-
description:
|
|
617
|
-
type:
|
|
618
|
-
default: false
|
|
619
|
-
}
|
|
620
|
-
],
|
|
621
|
-
arguments: []
|
|
622
|
-
});
|
|
623
|
-
this.registerCommand({
|
|
624
|
-
name: 'restart',
|
|
625
|
-
aliases: [],
|
|
626
|
-
description: 'Restart the proxy server process. Use this command when console or network command output becomes stale (not refreshing or showing old data). Restarting will clear the message store and start fresh monitoring.',
|
|
627
|
-
usage: 'chrome-cdp-cli restart [options]',
|
|
628
|
-
examples: [
|
|
629
|
-
{ command: 'chrome-cdp-cli restart', description: 'Restart the proxy server when logs are stale' },
|
|
630
|
-
{ command: 'chrome-cdp-cli restart --force', description: 'Force restart even if proxy is healthy' }
|
|
631
|
-
],
|
|
632
|
-
options: [
|
|
633
|
-
{
|
|
634
|
-
name: 'force',
|
|
635
|
-
short: 'f',
|
|
636
|
-
type: 'boolean',
|
|
637
|
-
description: 'Force restart even if proxy is healthy',
|
|
638
|
-
default: false
|
|
639
|
-
}
|
|
743
|
+
name: "force",
|
|
744
|
+
description: "Force overwrite existing files",
|
|
745
|
+
type: "boolean",
|
|
746
|
+
default: false,
|
|
747
|
+
},
|
|
640
748
|
],
|
|
641
|
-
arguments: []
|
|
749
|
+
arguments: [],
|
|
642
750
|
});
|
|
643
751
|
}
|
|
644
752
|
}
|