Skip to content

Commit 913786c

Browse files
committed
Add browser page close notice (#1270)
1 parent 1d2d85e commit 913786c

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ The browser module is the entry point for all your tests, and it is what interac
3838
| [browser.context()](/javascript-api/k6-experimental/browser/context) | Returns the current [BrowserContext](/javascript-api/k6-experimental/browser/browsercontext/). |
3939
| [browser.isConnected](/javascript-api/k6-experimental/browser/isconnected) <BWIPT id="453"/> | Indicates whether the [CDP](https://chromedevtools.github.io/devtools-protocol/) connection to the browser process is active or not. |
4040
| [browser.newContext([options])](/javascript-api/k6-experimental/browser/newcontext/) <BWIPT id="455"/> | Creates and returns a new [BrowserContext](/javascript-api/k6-experimental/browser/browsercontext/). |
41-
| [browser.newPage([options])](/javascript-api/k6-experimental/browser/newpage) <BWIPT id="455"/> | Creates a new [Page](/javascript-api/k6-experimental/browser/page/) in a new [BrowserContext](/javascript-api/k6-experimental/browser/browsercontext/) and returns the page. |
41+
| [browser.newPage([options])](/javascript-api/k6-experimental/browser/newpage) <BWIPT id="455"/> | Creates a new [Page](/javascript-api/k6-experimental/browser/page/) in a new [BrowserContext](/javascript-api/k6-experimental/browser/browsercontext/) and returns the page. Pages that have been opened ought to be closed using [`Page.close`](/javascript-api/k6-experimental/browser/page/close/). Pages left open could potentially distort the results of Web Vital metrics. |
4242
| [browser.version()](/javascript-api/k6-experimental/browser/version/) | Returns the browser application's version. |
4343

4444
### Example

src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/newpage--options--.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,12 @@ A 1-to-1 mapping between [Browser](/javascript-api/k6-experimental/browser) and
1111

1212
</Blockquote>
1313

14+
<Blockquote mod="attention" title="">
15+
16+
Pages that have been opened ought to be closed using [`Page.close`](/javascript-api/k6-experimental/browser/page/close/). Pages left open could potentially distort the results of Web Vital metrics.
17+
18+
</Blockquote>
19+
1420
<TableWithNestedRows>
1521

1622
| Parameter | Type | Default | Description |

src/data/markdown/translated-guides/en/03 Using k6 browser/02 Running browser tests.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,9 @@ To run a simple local script:
5959

6060
The preceding code imports the `browser` ([the browser module](/javascript-api/k6-experimental/browser)), and uses its `newPage` method to open a new page.
6161

62-
After getting the page, you can interact with it using the [Page](/javascript-api/k6-experimental/browser/page) methods. This example visits a test URL and takes a screenshot of the page. Afterwards, it closes the page.
62+
After getting the page, you can interact with it using the [Page](/javascript-api/k6-experimental/browser/page) methods. This example visits a test URL and takes a screenshot of the page.
63+
64+
Subsequently, the page is closed. This allows for the freeing up of allocated resources and enables the accurate calculation of [Web Vital metrics](/using-k6-browser/browser-metrics/).
6365

6466
<Blockquote mod="note" title="">
6567

0 commit comments

Comments
 (0)