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

Is it possible to trigger a file download on button click using k6-browser? #4170

Open
nexus9111 opened this issue Jan 13, 2025 · 1 comment
Assignees

Comments

@nexus9111
Copy link

nexus9111 commented Jan 13, 2025

Feature Description

Hello k6-browser team,

I'm currently exploring the capabilities of k6-browser for browser automation and performance testing. I have a scenario where I need to simulate a user clicking a button that triggers a file download. The file should ideally be downloaded to the local machine where the k6 test is running.

Is this currently possible with k6-browser? If so, could you provide an example or guidance on how to achieve this? If not, is this a feature that could be considered for future development?

Here’s a simplified example of what I’m trying to achieve:

// ...

export default function () {
  const context = await browser.newContext();
  const page = context.newPage();

  page.goto('https://example.com/download-page');
  page.click('button#download-button');

  // Wait for the file to be downloaded
  // How can I verify that the file has been downloaded to the local machine?

  browser.close();
}

Any insights or suggestions would be greatly appreciated!

Thank you in advance for your help.

Best regards

Suggested Solution (optional)

No response

Already existing or connected issues / PRs (optional)

No response

@ankur22 ankur22 transferred this issue from grafana/xk6-browser Jan 13, 2025
@ankur22
Copy link
Contributor

ankur22 commented Jan 13, 2025

@inancgumus do you remember where you were at with grafana/xk6-browser#1289?

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