-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Expand file tree
/
Copy pathchrome-devtools-cli-options.ts
More file actions
752 lines (750 loc) · 22.7 KB
/
chrome-devtools-cli-options.ts
File metadata and controls
752 lines (750 loc) · 22.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
/**
* @license
* Copyright 2026 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
// NOTE: do not edit manually. Auto-generated by 'npm run cli:generate'.
export interface ArgDef {
name: string;
type: string;
description: string;
required: boolean;
default?: string | number | boolean;
enum?: ReadonlyArray<string | number>;
}
export type Commands = Record<
string,
{
description: string;
category: string;
args: Record<string, ArgDef>;
}
>;
export const commands: Commands = {
click: {
description: 'Clicks on the provided element',
category: 'Input automation',
args: {
uid: {
name: 'uid',
type: 'string',
description:
'The uid of an element on the page from the page content snapshot',
required: true,
},
dblClick: {
name: 'dblClick',
type: 'boolean',
description: 'Set to true for double clicks. Default is false.',
required: false,
},
includeSnapshot: {
name: 'includeSnapshot',
type: 'boolean',
description:
'Whether to include a snapshot in the response. Default is false.',
required: false,
},
},
},
close_page: {
description:
'Closes the page by its index. The last open page cannot be closed.',
category: 'Navigation automation',
args: {
pageId: {
name: 'pageId',
type: 'number',
description:
'The ID of the page to close. Call list_pages to list pages.',
required: true,
},
},
},
drag: {
description: 'Drag an element onto another element',
category: 'Input automation',
args: {
from_uid: {
name: 'from_uid',
type: 'string',
description: 'The uid of the element to drag',
required: true,
},
to_uid: {
name: 'to_uid',
type: 'string',
description: 'The uid of the element to drop into',
required: true,
},
includeSnapshot: {
name: 'includeSnapshot',
type: 'boolean',
description:
'Whether to include a snapshot in the response. Default is false.',
required: false,
},
},
},
emulate: {
description: 'Emulates various features on the selected page.',
category: 'Emulation',
args: {
networkConditions: {
name: 'networkConditions',
type: 'string',
description: 'Throttle network. Omit to disable throttling.',
required: false,
enum: ['Offline', 'Slow 3G', 'Fast 3G', 'Slow 4G', 'Fast 4G'],
},
cpuThrottlingRate: {
name: 'cpuThrottlingRate',
type: 'number',
description:
'Represents the CPU slowdown factor. Omit or set the rate to 1 to disable throttling',
required: false,
},
geolocation: {
name: 'geolocation',
type: 'string',
description:
'Geolocation (`<latitude>x<longitude>`) to emulate. Latitude between -90 and 90. Longitude between -180 and 180. Omit clear the geolocation override.',
required: false,
},
userAgent: {
name: 'userAgent',
type: 'string',
description:
'User agent to emulate. Set to empty string to clear the user agent override.',
required: false,
},
colorScheme: {
name: 'colorScheme',
type: 'string',
description:
'Emulate the dark or the light mode. Set to "auto" to reset to the default.',
required: false,
enum: ['dark', 'light', 'auto'],
},
viewport: {
name: 'viewport',
type: 'string',
description:
"Emulate device viewports '<width>x<height>x<devicePixelRatio>[,mobile][,touch][,landscape]'. 'touch' and 'mobile' to emulate mobile devices. 'landscape' to emulate landscape mode.",
required: false,
},
},
},
evaluate_script: {
description:
'Evaluate a JavaScript function inside the currently selected page. Returns the response as JSON,\nso returned values have to be JSON-serializable.',
category: 'Debugging',
args: {
function: {
name: 'function',
type: 'string',
description:
'A JavaScript function declaration to be executed by the tool in the currently selected page.\nExample without arguments: `() => {\n return document.title\n}` or `async () => {\n return await fetch("example.com")\n}`.\nExample with arguments: `(el) => {\n return el.innerText;\n}`\n',
required: true,
},
args: {
name: 'args',
type: 'array',
description: 'An optional list of arguments to pass to the function.',
required: false,
},
},
},
fill: {
description:
'Type text into a input, text area or select an option from a <select> element.',
category: 'Input automation',
args: {
uid: {
name: 'uid',
type: 'string',
description:
'The uid of an element on the page from the page content snapshot',
required: true,
},
value: {
name: 'value',
type: 'string',
description: 'The value to fill in',
required: true,
},
includeSnapshot: {
name: 'includeSnapshot',
type: 'boolean',
description:
'Whether to include a snapshot in the response. Default is false.',
required: false,
},
},
},
fill_form: {
description: 'Fill out multiple form elements at once',
category: 'Input automation',
args: {
elements: {
name: 'elements',
type: 'array',
description: 'Elements from snapshot to fill out.',
required: true,
},
includeSnapshot: {
name: 'includeSnapshot',
type: 'boolean',
description:
'Whether to include a snapshot in the response. Default is false.',
required: false,
},
},
},
get_console_message: {
description:
'Gets a console message by its ID. You can get all messages by calling list_console_messages.',
category: 'Debugging',
args: {
msgid: {
name: 'msgid',
type: 'number',
description:
'The msgid of a console message on the page from the listed console messages',
required: true,
},
},
},
get_network_request: {
description:
'Gets a network request by an optional reqid, if omitted returns the currently selected request in the DevTools Network panel.',
category: 'Network',
args: {
reqid: {
name: 'reqid',
type: 'number',
description:
'The reqid of the network request. If omitted returns the currently selected request in the DevTools Network panel.',
required: false,
},
requestFilePath: {
name: 'requestFilePath',
type: 'string',
description:
'The absolute or relative path to save the request body to. If omitted, the body is returned inline.',
required: false,
},
responseFilePath: {
name: 'responseFilePath',
type: 'string',
description:
'The absolute or relative path to save the response body to. If omitted, the body is returned inline.',
required: false,
},
},
},
handle_dialog: {
description:
'If a browser dialog was opened, use this command to handle it',
category: 'Input automation',
args: {
action: {
name: 'action',
type: 'string',
description: 'Whether to dismiss or accept the dialog',
required: true,
enum: ['accept', 'dismiss'],
},
promptText: {
name: 'promptText',
type: 'string',
description: 'Optional prompt text to enter into the dialog.',
required: false,
},
},
},
hover: {
description: 'Hover over the provided element',
category: 'Input automation',
args: {
uid: {
name: 'uid',
type: 'string',
description:
'The uid of an element on the page from the page content snapshot',
required: true,
},
includeSnapshot: {
name: 'includeSnapshot',
type: 'boolean',
description:
'Whether to include a snapshot in the response. Default is false.',
required: false,
},
},
},
lighthouse_audit: {
description:
'Get Lighthouse score and reports for accessibility, SEO and best practices. This excludes performance. For performance audits, run performance_start_trace',
category: 'Debugging',
args: {
mode: {
name: 'mode',
type: 'string',
description:
'"navigation" reloads & audits. "snapshot" analyzes current state.',
required: false,
default: 'navigation',
enum: ['navigation', 'snapshot'],
},
device: {
name: 'device',
type: 'string',
description: 'Device to emulate.',
required: false,
default: 'desktop',
enum: ['desktop', 'mobile'],
},
outputDirPath: {
name: 'outputDirPath',
type: 'string',
description: 'Directory for reports. If omitted, uses temporary files.',
required: false,
},
},
},
list_console_messages: {
description:
'List all console messages for the currently selected page since the last navigation.',
category: 'Debugging',
args: {
pageSize: {
name: 'pageSize',
type: 'integer',
description:
'Maximum number of messages to return. When omitted, returns all requests.',
required: false,
},
pageIdx: {
name: 'pageIdx',
type: 'integer',
description:
'Page number to return (0-based). When omitted, returns the first page.',
required: false,
},
types: {
name: 'types',
type: 'array',
description:
'Filter messages to only return messages of the specified resource types. When omitted or empty, returns all messages.',
required: false,
},
includePreservedMessages: {
name: 'includePreservedMessages',
type: 'boolean',
description:
'Set to true to return the preserved messages over the last 3 navigations.',
required: false,
default: false,
},
},
},
list_network_requests: {
description:
'List all requests for the currently selected page since the last navigation.',
category: 'Network',
args: {
pageSize: {
name: 'pageSize',
type: 'integer',
description:
'Maximum number of requests to return. When omitted, returns all requests.',
required: false,
},
pageIdx: {
name: 'pageIdx',
type: 'integer',
description:
'Page number to return (0-based). When omitted, returns the first page.',
required: false,
},
resourceTypes: {
name: 'resourceTypes',
type: 'array',
description:
'Filter requests to only return requests of the specified resource types. When omitted or empty, returns all requests.',
required: false,
},
includePreservedRequests: {
name: 'includePreservedRequests',
type: 'boolean',
description:
'Set to true to return the preserved requests over the last 3 navigations.',
required: false,
default: false,
},
},
},
list_pages: {
description: 'Get a list of pages open in the browser.',
category: 'Navigation automation',
args: {},
},
navigate_page: {
description:
'Go to a URL, or back, forward, or reload. Use project URL if not specified otherwise.',
category: 'Navigation automation',
args: {
type: {
name: 'type',
type: 'string',
description:
'Navigate the page by URL, back or forward in history, or reload.',
required: false,
enum: ['url', 'back', 'forward', 'reload'],
},
url: {
name: 'url',
type: 'string',
description: 'Target URL (only type=url)',
required: false,
},
ignoreCache: {
name: 'ignoreCache',
type: 'boolean',
description: 'Whether to ignore cache on reload.',
required: false,
},
handleBeforeUnload: {
name: 'handleBeforeUnload',
type: 'string',
description:
'Whether to auto accept or beforeunload dialogs triggered by this navigation. Default is accept.',
required: false,
enum: ['accept', 'decline'],
},
initScript: {
name: 'initScript',
type: 'string',
description:
'A JavaScript script to be executed on each new document before any other scripts for the next navigation.',
required: false,
},
timeout: {
name: 'timeout',
type: 'integer',
description:
'Maximum wait time in milliseconds. If set to 0, the default timeout will be used.',
required: false,
},
},
},
new_page: {
description:
'Open a new tab and load a URL. Use project URL if not specified otherwise.',
category: 'Navigation automation',
args: {
url: {
name: 'url',
type: 'string',
description: 'URL to load in a new page.',
required: true,
},
background: {
name: 'background',
type: 'boolean',
description:
'Whether to open the page in the background without bringing it to the front. Default is false (foreground).',
required: false,
},
isolatedContext: {
name: 'isolatedContext',
type: 'string',
description:
'If specified, the page is created in an isolated browser context with the given name. Pages in the same browser context share cookies and storage. Pages in different browser contexts are fully isolated.',
required: false,
},
timeout: {
name: 'timeout',
type: 'integer',
description:
'Maximum wait time in milliseconds. If set to 0, the default timeout will be used.',
required: false,
},
},
},
performance_analyze_insight: {
description:
'Provides more detailed information on a specific Performance Insight of an insight set that was highlighted in the results of a trace recording.',
category: 'Performance',
args: {
insightSetId: {
name: 'insightSetId',
type: 'string',
description:
'The id for the specific insight set. Only use the ids given in the "Available insight sets" list.',
required: true,
},
insightName: {
name: 'insightName',
type: 'string',
description:
'The name of the Insight you want more information on. For example: "DocumentLatency" or "LCPBreakdown"',
required: true,
},
},
},
performance_start_trace: {
description:
'Start a performance trace on the selected webpage. Use to find frontend performance issues, Core Web Vitals (LCP, INP, CLS), and improve page load speed.',
category: 'Performance',
args: {
reload: {
name: 'reload',
type: 'boolean',
description:
'Determines if, once tracing has started, the current selected page should be automatically reloaded. Navigate the page to the right URL using the navigate_page tool BEFORE starting the trace if reload or autoStop is set to true.',
required: false,
default: true,
},
autoStop: {
name: 'autoStop',
type: 'boolean',
description:
'Determines if the trace recording should be automatically stopped.',
required: false,
default: true,
},
filePath: {
name: 'filePath',
type: 'string',
description:
'The absolute file path, or a file path relative to the current working directory, to save the raw trace data. For example, trace.json.gz (compressed) or trace.json (uncompressed).',
required: false,
},
},
},
performance_stop_trace: {
description:
'Stop the active performance trace recording on the selected webpage.',
category: 'Performance',
args: {
filePath: {
name: 'filePath',
type: 'string',
description:
'The absolute file path, or a file path relative to the current working directory, to save the raw trace data. For example, trace.json.gz (compressed) or trace.json (uncompressed).',
required: false,
},
},
},
press_key: {
description:
'Press a key or key combination. Use this when other input methods like fill() cannot be used (e.g., keyboard shortcuts, navigation keys, or special key combinations).',
category: 'Input automation',
args: {
key: {
name: 'key',
type: 'string',
description:
'A key or a combination (e.g., "Enter", "Control+A", "Control++", "Control+Shift+R"). Modifiers: Control, Shift, Alt, Meta',
required: true,
},
includeSnapshot: {
name: 'includeSnapshot',
type: 'boolean',
description:
'Whether to include a snapshot in the response. Default is false.',
required: false,
},
},
},
resize_page: {
description:
"Resizes the selected page's window so that the page has specified dimension",
category: 'Emulation',
args: {
width: {
name: 'width',
type: 'number',
description: 'Page width',
required: true,
},
height: {
name: 'height',
type: 'number',
description: 'Page height',
required: true,
},
},
},
select_page: {
description: 'Select a page as a context for future tool calls.',
category: 'Navigation automation',
args: {
pageId: {
name: 'pageId',
type: 'number',
description:
'The ID of the page to select. Call list_pages to get available pages.',
required: true,
},
bringToFront: {
name: 'bringToFront',
type: 'boolean',
description: 'Whether to focus the page and bring it to the top.',
required: false,
},
},
},
take_memory_snapshot: {
description:
'Capture a memory heapsnapshot of the currently selected page to memory leak debugging',
category: 'Performance',
args: {
filePath: {
name: 'filePath',
type: 'string',
description:
'A path to a .heapsnapshot file to save the heapsnapshot to.',
required: true,
},
},
},
take_screenshot: {
description: 'Take a screenshot of the page or element.',
category: 'Debugging',
args: {
format: {
name: 'format',
type: 'string',
description:
'Type of format to save the screenshot as. Default is "png"',
required: false,
default: 'png',
enum: ['png', 'jpeg', 'webp'],
},
quality: {
name: 'quality',
type: 'number',
description:
'Compression quality for JPEG and WebP formats (0-100). Higher values mean better quality but larger file sizes. Ignored for PNG format.',
required: false,
},
uid: {
name: 'uid',
type: 'string',
description:
'The uid of an element on the page from the page content snapshot. If omitted takes a pages screenshot.',
required: false,
},
fullPage: {
name: 'fullPage',
type: 'boolean',
description:
'If set to true takes a screenshot of the full page instead of the currently visible viewport. Incompatible with uid.',
required: false,
},
filePath: {
name: 'filePath',
type: 'string',
description:
'The absolute path, or a path relative to the current working directory, to save the screenshot to instead of attaching it to the response.',
required: false,
},
},
},
take_snapshot: {
description:
'Take a text snapshot of the currently selected page based on the a11y tree. The snapshot lists page elements along with a unique\nidentifier (uid). Always use the latest snapshot. Prefer taking a snapshot over taking a screenshot. The snapshot indicates the element selected\nin the DevTools Elements panel (if any).',
category: 'Debugging',
args: {
verbose: {
name: 'verbose',
type: 'boolean',
description:
'Whether to include all possible information available in the full a11y tree. Default is false.',
required: false,
},
filePath: {
name: 'filePath',
type: 'string',
description:
'The absolute path, or a path relative to the current working directory, to save the snapshot to instead of attaching it to the response.',
required: false,
},
},
},
type_text: {
description: 'Type text using keyboard into a previously focused input',
category: 'Input automation',
args: {
text: {
name: 'text',
type: 'string',
description: 'The text to type',
required: true,
},
submitKey: {
name: 'submitKey',
type: 'string',
description:
'Optional key to press after typing. E.g., "Enter", "Tab", "Escape"',
required: false,
},
},
},
upload_file: {
description: 'Upload a file through a provided element.',
category: 'Input automation',
args: {
uid: {
name: 'uid',
type: 'string',
description:
'The uid of the file input element or an element that will open file chooser on the page from the page content snapshot',
required: true,
},
filePath: {
name: 'filePath',
type: 'string',
description:
'The local path of a file to upload. Use filePaths for multiple files.',
required: false,
},
filePaths: {
name: 'filePaths',
type: 'array',
description: 'One or more local file paths to upload in a single call.',
required: false,
},
includeSnapshot: {
name: 'includeSnapshot',
type: 'boolean',
description:
'Whether to include a snapshot in the response. Default is false.',
required: false,
},
},
},
wait_for: {
description: 'Wait for the specified text to appear on the selected page.',
category: 'Navigation automation',
args: {
text: {
name: 'text',
type: 'array',
description:
'Non-empty list of texts. Resolves when any value appears on the page.',
required: true,
},
timeout: {
name: 'timeout',
type: 'integer',
description:
'Maximum wait time in milliseconds. If set to 0, the default timeout will be used.',
required: false,
},
},
},
} as const;