|
1 | 1 | ---
|
2 | 2 | title: 'k6/browser'
|
3 | 3 | description: 'An overview of the browser-level APIs from browser module.'
|
4 |
| -weight: 01 |
| 4 | +weight: 02 |
5 | 5 | ---
|
6 | 6 |
|
7 | 7 | # browser
|
@@ -34,14 +34,14 @@ The browser module is the entry point for all your tests, and it is what interac
|
34 | 34 | - [BrowserContext](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/k6-browser/browsercontext) which is where you can set a variety of attributes to control the behavior of pages;
|
35 | 35 | - and [Page](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/k6-browser/page) which is where your rendered site is displayed.
|
36 | 36 |
|
37 |
| -| Method | Description | |
38 |
| -| -------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | |
39 |
| -| [browser.context()](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/k6-browser/context) | Returns the current [BrowserContext](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/k6-browser/browsercontext). | |
40 |
| -| [browser.closeContext()](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/k6-browser/closecontext) | Closes the current [BrowserContext](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/k6-browser/browsercontext). | |
41 |
| -| [browser.isConnected](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/k6-browser/isconnected) {{< docs/bwipt id="453" >}} | Indicates whether the [CDP](https://chromedevtools.github.io/devtools-protocol/) connection to the browser process is active or not. | |
42 |
| -| [browser.newContext([options])](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/k6-browser/newcontext/) {{< docs/bwipt id="455" >}} | Creates and returns a new [BrowserContext](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/k6-browser/browsercontext). | |
| 37 | +| Method | Description | |
| 38 | +| ------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | |
| 39 | +| [browser.context()](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/k6-browser/context) | Returns the current [BrowserContext](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/k6-browser/browsercontext). | |
| 40 | +| [browser.closeContext()](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/k6-browser/closecontext) | Closes the current [BrowserContext](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/k6-browser/browsercontext). | |
| 41 | +| [browser.isConnected](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/k6-browser/isconnected) {{< docs/bwipt id="453" >}} | Indicates whether the [CDP](https://chromedevtools.github.io/devtools-protocol/) connection to the browser process is active or not. | |
| 42 | +| [browser.newContext([options])](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/k6-browser/newcontext/) {{< docs/bwipt id="455" >}} | Creates and returns a new [BrowserContext](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/k6-browser/browsercontext). | |
43 | 43 | | [browser.newPage([options])](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/k6-browser/newpage) {{< docs/bwipt id="455" >}} | Creates a new [Page](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/k6-browser/page) in a new [BrowserContext](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/k6-browser/browsercontext) and returns the page. Pages that have been opened ought to be closed using [`Page.close`](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/k6-browser/page/close). Pages left open could potentially distort the results of Web Vital metrics. |
|
44 |
| -| [browser.version()](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/k6-browser/version) | Returns the browser application's version. | |
| 44 | +| [browser.version()](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/k6-browser/version) | Returns the browser application's version. | |
45 | 45 |
|
46 | 46 | ### Example
|
47 | 47 |
|
@@ -113,20 +113,20 @@ PS C:\k6> k6 run script.js
|
113 | 113 |
|
114 | 114 | ## Browser-level APIs
|
115 | 115 |
|
116 |
| -| k6 Class | Description | |
117 |
| -| ----------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | |
| 116 | +| k6 Class | Description | |
| 117 | +| ---------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- | |
118 | 118 | | [BrowserContext](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/k6-browser/browsercontext) {{< docs/bwipt >}} | Enables independent browser sessions with separate [Page](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/k6-browser/page)s, cache, and cookies. |
|
119 |
| -| [ElementHandle](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/k6-browser/elementhandle) {{< docs/bwipt >}} | Represents an in-page DOM element. | |
| 119 | +| [ElementHandle](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/k6-browser/elementhandle) {{< docs/bwipt >}} | Represents an in-page DOM element. | |
120 | 120 | | [Frame](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/k6-browser/frame) {{< docs/bwipt >}} | Access and interact with the [`Page`](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/k6-browser/page).'s `Frame`s. |
|
121 |
| -| [JSHandle](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/k6-browser/jshandle) | Represents an in-page JavaScript object. | |
| 121 | +| [JSHandle](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/k6-browser/jshandle) | Represents an in-page JavaScript object. | |
122 | 122 | | [Keyboard](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/k6-browser/keyboard) | Used to simulate the keyboard interactions with the associated [`Page`](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/k6-browser/page). |
|
123 |
| -| [Locator](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/k6-browser/locator) | The Locator API makes it easier to work with dynamically changing elements. | |
| 123 | +| [Locator](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/k6-browser/locator) | The Locator API makes it easier to work with dynamically changing elements. | |
124 | 124 | | [Mouse](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/k6-browser/mouse) | Used to simulate the mouse interactions with the associated [`Page`](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/k6-browser/page). |
|
125 |
| -| [Page](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/k6-browser/page) {{< docs/bwipt >}} | Provides methods to interact with a single tab in a browser. | |
| 125 | +| [Page](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/k6-browser/page) {{< docs/bwipt >}} | Provides methods to interact with a single tab in a browser. | |
126 | 126 | | [Request](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/k6-browser/request) {{< docs/bwipt >}} | Used to keep track of the request the [`Page`](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/k6-browser/page) makes. |
|
127 | 127 | | [Response](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/k6-browser/response) {{< docs/bwipt >}} | Represents the response received by the [`Page`](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/k6-browser/page). |
|
128 | 128 | | [Touchscreen](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/k6-browser/touchscreen) | Used to simulate touch interactions with the associated [`Page`](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/k6-browser/page). |
|
129 |
| -| [Worker](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/k6-browser/worker) | Represents a [WebWorker](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API). | |
| 129 | +| [Worker](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/k6-browser/worker) | Represents a [WebWorker](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API). | |
130 | 130 |
|
131 | 131 | ## Browser Module Options
|
132 | 132 |
|
|
0 commit comments