https://github.com/grafana/xk6-browser
The browser module adds support for browser automation and end-to-end web testing via the Chrome Devtools Protocol to k6.
https://github.com/grafana/xk6-browser
browser-automation cdp chromedevtoolsprotocol end-to-end-testing k6
Last synced: 6 months ago
JSON representation
The browser module adds support for browser automation and end-to-end web testing via the Chrome Devtools Protocol to k6.
- Host: GitHub
- URL: https://github.com/grafana/xk6-browser
- Owner: grafana
- License: agpl-3.0
- Created: 2021-03-07T17:02:34.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2024-12-06T17:35:11.000Z (10 months ago)
- Last Synced: 2024-12-06T21:15:29.255Z (10 months ago)
- Topics: browser-automation, cdp, chromedevtoolsprotocol, end-to-end-testing, k6
- Language: Go
- Homepage: https://grafana.com/docs/k6/latest/javascript-api/k6-browser/
- Size: 15.5 MB
- Stars: 346
- Watchers: 146
- Forks: 41
- Open Issues: 298
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
- Codeowners: CODEOWNERS
- Security: SECURITY.md
- Support: SUPPORT.md
Awesome Lists containing this project
README
> [!WARNING]
> Starting from k6 version v0.56, this codebase has been merged and is now part of the [main k6 repository](https://github.com/grafana/k6). Please contribute and [open issues there](https://github.com/grafana/k6/issues). This repository is no longer maintained.Browser automation and end-to-end web testing for k6
A module for k6 adding browser-level APIs with rough Playwright compatibility.
Download ·
Documentation ·
Community Forum ·
Public Roadmap ·
![]()
**k6-browser** is a [k6](https://grafana.com/docs/k6/latest/) module that supports browser automation through the [Chrome Devtools Protocol](https://chromedevtools.github.io/devtools-protocol/) (CDP). It adds browser-level APIs to interact with browsers and collect frontend performance metrics as part of your k6 tests.
**As of [k6 version 0.52.0](https://github.com/grafana/k6/releases/tag/v0.52.0), k6-browser is now bundled in k6 as a core module and usable without a separate binary or compilation step!**
Special acknowledgment to the authors of [Playwright](https://playwright.dev/) and [Puppeteer](https://github.com/puppeteer/puppeteer) for their trailblazing work in this area.
## Goals
- Bring browser automation to the k6 testing platform while supporting core k6 features like VU executors, scenarios, metrics, checks, thresholds, logging, DNS remapping, IP blocklists, etc.
- Test stability as the top priority by supporting non-flaky [selectors](https://playwright.dev/docs/api/class-selectors) combined with [auto-waiting](https://playwright.dev/docs/actionability/) for actions just like Playwright.
- Aim for rough API compatibility with [Playwright](https://github.com/microsoft/playwright). The reason for this is twofold: first, we don't want users to have to learn a completely new API just to use xk6-browser, and second, it opens up the possibility of using the [Playwright RPC server](https://github.com/mxschmitt/playwright-go) as an optional backend for the k6 browser module should we decide to support that in the future.
- Support for Chromium-compatible browsers first, and eventually Firefox and WebKit-based browsers.Please take a look at our [project roadmap](https://github.com/orgs/grafana/projects/443/views/1) for more details.
## Get started
- [Getting Started](https://grafana.com/docs/k6/latest/using-k6-browser/)
- [Running xk6-browser](https://grafana.com/docs/k6/latest/using-k6-browser/running-browser-tests/)
- [Browser Metrics](https://grafana.com/docs/k6/latest/using-k6-browser/metrics/)
- [Selecting Elements](https://grafana.com/docs/k6/latest/using-k6-browser/recommended-practices/selecting-elements/)## Documentation
- [Releases](https://github.com/grafana/xk6-browser/releases)
- [API Documentation](https://grafana.com/docs/k6/latest/javascript-api/k6-browser) - This documents how to use our API and its current state with xk6-browser.## Get help
- If you're having issues installing or running xk6-browser, refer to [TROUBLESHOOTING](/TROUBLESHOOTING.md).
- To get help with usage, report bugs, suggest features, and discuss xk6-browser with other users, see [SUPPORT.md](SUPPORT.md).
- Community discussion happens at the [xk6-browser forum](https://community.grafana.com/c/grafana-k6/k6-browser/79).## Additional resources
To find out more about xk6-browser or browser testing in general, check out the following links.
**Note:** Since our API is still transitioning, some of the code snippets from the links below might be inaccurate, though the concepts should still be correct. For the latest, please take a look at our up-to-date [API documentation](https://grafana.com/docs/k6/latest/javascript-api/k6-browser).
- [How to add browser-level APIs for web performance metrics](https://grafana.com/blog/2023/01/08/how-to-add-browser-level-apis-for-web-performance-metrics/) - This post explains how to get started with k6 browser to interact with browsers and collect web performance metrics as part of your Grafana k6 tests.
- [Using k6 browser](https://grafana.com/docs/k6/latest/using-k6-browser/) - Get started with the k6 browser module.