I am trying to install and build the xk6 extension with instructions from Introducing browser automation and end-to-end web testing with k6.
I run the following command
HTTPS_PROXY=http://osa0002:XXXXXXX@proxylb.internal.epo.org:8080 go install github.com/grafana/xk6@latest
i get the following response and the install does not seem to be successful:
go: github.com/grafana/xk6@latest: email@example.com: parsing go.mod:
module declares its path as: go.k6.io/xk6
but was required as: GitHub - grafana/xk6: Build k6 with extensions
I cannot run the build command.
Is there something i need to change in order for the install to work?
you’re using an outdated forum post as reference which uses a wrong command to install xk6. I’ve updated it now to include the correct command, which is:
go install go.k6.io/xk6/cmd/xk6@latest
In the future, please refer to the README in the xk6-browser repository, or the documentation.
Thanks for you response.
I did the following:
I ran go install go.k6.io/xk6/cmd/xk6@latest then xk6 build --with GitHub - grafana/xk6-browser: k6 extension that adds support for browser automation and end-to-end web testing via the Chrome Devtools Protocol. This created a new k6 binary, i get the following message:
xk6 has now produced a new k6 binary which may be different than the command on your system path!
Be sure to run ‘.\k6.exe run <SCRIPT_NAME>’ from the ‘D:\k6\scripts\k6\bdds’ directory.
I then run echo %PATH% and it shows the following path for k6 C:\Program Files\k6\ and the following for Go C:\Program Files\Go\bin;. I replace the k6.exe in this path (C:\Program Files\k6\ ) with the new binary.
I then copy the script from
Browser Module Documentation and run the command: xk6-browser run browser_test.js
I get the following error: bash: xk6-browser: command not found.
Is the new binary not being used or am i still doing something wrong?
Well, you replaced the
k6.exe binary, so there’s no
xk6-browser.exe anywhere in your
I wouldn’t recommend replacing
C:\Program Files\k6\k6.exe since that’s the binary of the k6 MSI package you installed. Instead, you could place
xk6-browser.exe in the same directory, and that should make
xk6-browser available system-wide, since
C:\Program Files\k6\ is already in your
Im not sure where i get the xk6-browser.exe from.
After running http://go.k6.io/xk6/cmd/xk6@latest then xk6 build, a new file called k6.exe i created. Where do i get the xk6-browser.exe file from?
Ah, my apologies, I misread your previous post.
In that case, if you replaced
C:\Program Files\k6\k6.exe with the new binary, you should run the command
k6 run browser_test.js instead.
xk6-browser.exe binary can be created by changing the
--output option passed to
xk6 build. E.g.
xk6 build --output xk6-browser --with github.com/grafana/xk6-browser, or by downloading it from our pre-built packages in the GitHub release. Or you could just rename it manually.
I now see that our documentation is a bit confusing about this, and we’ll fix it shortly. Sorry for the confusion.