Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Support for page.on('request'), page.route(), and CDP Access in k6 Browser Module #4020

Open
aupadhyay-coursera opened this issue Oct 26, 2024 · 1 comment
Assignees

Comments

@aupadhyay-coursera
Copy link

Feature Description

Feature Request: Add Support for page.on('request'), page.route(), and CDP Access in k6 Browser Module

Description:
There is a need for enhanced functionality in the k6 browser module. Specifically, methods like page.on('request') and page.route() used in Playwright/Puppeteer are not available. Additionally, the k6 browser module doesn’t expose Chrome DevTools Protocol (CDP) sessions, limiting our ability to intercept network traffic.

Proposed Features:

  1. Add Support for page.on('request'):

    • Enable event listeners for network requests similar to Playwright/Puppeteer.
    • Example use case: Logging or manipulating request/response headers.
  2. Add Support for page.route():

    • Enable request interception and the ability to mock responses or alter requests.
    • Example use case: Testing application behavior under different network conditions or simulating specific API responses.
  3. Expose CDP Sessions:

    • Provide access to Chrome DevTools Protocol (CDP) sessions.
    • Example use case: Intercepting network traffic, gathering performance metrics, or accessing detailed browser logs.

Use Cases:

  1. Enhanced Network Interception: Intercept network requests and modify them on the fly during load testing, enabling more detailed and specific test scenarios.
  2. Mocking and Simulating Network Conditions: Mock specific API responses or simulate network issues to test the resilience of applications.
  3. Gathering Detailed Metrics: Access performance metrics and browser logs via CDP to gain deeper insights into application performance under load.

Adding these features would align k6's capabilities more closely with existing browser automation tools like Playwright and Puppeteer, providing more comprehensive testing abilities.

Thank you for considering this request.

Suggested Solution (optional)

No response

Already existing or connected issues / PRs (optional)

No response

@ankur22
Copy link
Contributor

ankur22 commented Oct 29, 2024

@aupadhyay-coursera thanks for opening an issue for these three feature requests that you've mentioned. They all have good use cases and ones which we would like to work on. We can't say when we will get to them but we will keep this issue open until we have a better idea of what the next steps are for this. I am working with the team to get a better answer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants