docs: add note on recording HAR files with Browser.newContext (#36630)
This commit is contained in:
parent
5116bd414b
commit
5b9d836e97
|
@ -232,6 +232,16 @@ The options object can contain the URL so that only requests with the URL matchi
|
|||
|
||||
Setting `update` option to true will create or update the HAR file with the actual network information instead of serving the requests from the HAR file. Use it when creating a test to populate the HAR with real data.
|
||||
|
||||
####
|
||||
* langs: js
|
||||
|
||||
Alternatively, you can also record HAR files by using the [`option: Browser.newContext.recordHar`] option in [`method: Browser.newContext`] when creating a browser context. This allows you to capture all network traffic for the entire context until the context is closed.
|
||||
|
||||
####
|
||||
* langs: csharp, java, python
|
||||
|
||||
Alternatively, you can also record HAR files by using the [`option: Browser.newContext.recordHarPath`] option in [`method: Browser.newContext`] when creating a browser context. This allows you to capture all network traffic for the entire context until the context is closed.
|
||||
|
||||
```js
|
||||
test('records or updates the HAR file', async ({ page }) => {
|
||||
// Get the response from the HAR file
|
||||
|
|
Loading…
Reference in New Issue