You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Adds on-demand HAR recording to `Tracing`, available on both
`BrowserContext.tracing` and `APIRequestContext.tracing`. Unlike
`recordHar`, this can be scoped to an individual flow via explicit
start/stop calls.
Copy file name to clipboardExpand all lines: docs/src/api/class-tracing.md
+74Lines changed: 74 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -303,6 +303,75 @@ given name prefix inside the [`option: BrowserType.launch.tracesDir`] directory
303
303
To specify the final trace zip file name, you need to pass `path` option to
304
304
[`method: Tracing.stopChunk`] instead.
305
305
306
+
## async method: Tracing.startHar
307
+
* since: v1.60
308
+
- returns: <[Disposable]>
309
+
310
+
Start recording a HAR (HTTP Archive) of network activity in this context. The HAR file is written to disk when [`method: Tracing.stopHar`] is called, or when the returned [Disposable] is disposed.
311
+
312
+
Only one HAR recording can be active at a time per [BrowserContext].
Path on the filesystem to write the HAR file to. If the file name ends with `.zip`, the HAR is saved as a zip archive with response bodies attached as separate files.
Optional setting to control resource content management. If `omit` is specified, content is not persisted. If `attach` is specified, resources are persisted as separate files or entries in the ZIP archive. If `embed` is specified, content is stored inline the HAR file as per HAR specification. Defaults to `attach` for `.zip` output files and to `embed` for all other file extensions.
362
+
363
+
### option: Tracing.startHar.mode
364
+
* since: v1.60
365
+
-`mode` <[HarMode]<"full"|"minimal">>
366
+
367
+
When set to `minimal`, only record information necessary for routing from HAR. This omits sizes, timing, page, cookies, security and other types of HAR information that are not used when replaying from HAR. Defaults to `full`.
368
+
369
+
### option: Tracing.startHar.urlFilter
370
+
* since: v1.60
371
+
-`urlFilter` <[string]|[RegExp]>
372
+
373
+
A glob or regex pattern to filter requests that are stored in the HAR. Defaults to none.
374
+
306
375
## async method: Tracing.group
307
376
* since: v1.49
308
377
- returns: <[Disposable]>
@@ -400,3 +469,8 @@ Stop the trace chunk. See [`method: Tracing.startChunk`] for more details about
400
469
-`path` <[path]>
401
470
402
471
Export trace collected since the last [`method: Tracing.startChunk`] call into the file with the given path.
472
+
473
+
## async method: Tracing.stopHar
474
+
* since: v1.60
475
+
476
+
Stop HAR recording and save the HAR file to the path given to [`method: Tracing.startHar`].
0 commit comments