I’m having some trouble using the k6 browser, and I’m hoping someone can help me out. I’m using the steps and script.js from the k6 documentation (Running browser tests), but I keep getting the following error message:
GoError: unknown module: k6/x/browser
I’m using k6 version v0.43.1 (2023-02-27T10:53:03+0000/v0.43.1-0-gaf3a0b89, go1.19.6, windows/amd64)
I’ve found that the k6 documentation is often lacking in detail, and it’s not clear to me what I might be doing wrong. Has anyone else encountered this issue before, and if so, how did you resolve it?
I have uninstalled and reinstalled the latest version of k6.
I appreciate any help or advice you can offer. Thanks in advance!
Do you enable k6 browser when running the script with K6_BROWSER_ENABLED=true? This is documented in the page you are referencing: Running browser tests. And there is also this blog to help get you started: Get Started with k6 browser. However we do not speciffy there the differences between oerqting systems.
If you are running on Windows, it could be that the variable is not being set. Examples on how to set variables for Windows: Environment variables. The way to do it varies between CMD and Powershell. Can you try setting the variable for Windows depending on your execution (CMD or Powershell) and get back here if that works? We can always add this to the browser docs if that is the issue you are experiencing.
Hi @Lewys ,
Take into account all recommendations given by @eyeveebe . But also, in this case, I believe the error is because you are using the import path corresponding to xk6-browser as extension. Now that xk6-browser is included as experimental module in k6 (since you are using k6 binary) the import path should be:
I believe this should be updated in the docs, let us know otherwise or if you have any problem.