While we intend to keep this module as simple and stable as possible, we may need to add features or introduce breaking changes. This could happen at any time until we release this module as stable.
Experimental module, use at your own risk
Feel free to provide user feedback, and open an issue or pull request if you have any suggestions.
The browser module APIs aim for rough compatibility with the Playwright API for NodeJS.
Note that because k6 does not run in NodeJS, the browser module APIs will slightly differ from their Playwright counterparts.
To work with the browser module, make sure you are using k6 version 0.43.0 or above.
The table below lists the importable properties from the top level module ('k6/experimental/browser').
|chromium||A BrowserType to launch tests in a Chromium-based browser.|
|devices||Returns predefined emulation settings for many end-user devices that can be used to simulate browser behavior on a mobile device. See the devices example below.|
|version||Returns the version number of k6 browser.|
To emulate the browser behaviour on a mobile device and approximately measure the browser performance, you can import devices from k6/experimental/browser.
|Browser||The entry point for all tests and used to launch BrowserContexts and Pages.|
|BrowserContext||Enables independent browser sessions with separate Pages, cache, and cookies.|
|BrowserType||The BrowserType is the entry point into launching a browser process; chromium is currently the only supported BrowserType.|
|ElementHandle||Represents an in-page DOM element.|
|Frame||Access and interact with the Page.'s Frames.|
|Keyboard||Used to simulate the keyboard interactions with the associated Page.|
|Locator||The Locator API makes it easier to work with dynamically changing elements.|
|Mouse||Used to simulate the mouse interactions with the associated Page.|
|Page||Provides methods to interact with a single tab in a Browser.|
|Request||Used to keep track of the request the Page makes.|
|Response||Represents the response received by the Page.|
|Touchscreen||Used to simulate touch interactions with the associated Page.|
|Worker||Represents a WebWorker.|