Attempting to use k6 browser recorder for web-based application results in Unknown Error Occurred

Hey all,

I was recently made aware of k6 as a tool by my testing coach and at first decided to evaluate the pure k6 flavor, writing all of the code and requests by hand for my performance tests. This was fun to learn how to do, but a bit tedious only because the web application I was attempting to use it on has some pretty unfortunately large request objects that can be a bit difficult to escape correctly and format so it’s readable within the script.

I recently decided to give xk6-browser a shot now that I was more familiar with how it was working, and I have to say I was very impressed when I realized it took care of recording all of the request bodies needed for all of the user actions as it was recording.

However, the issue I have with the xk6-browser is that it’s only able to start recording after I’ve logged into the application. I receive “An unknown error occurred” when trying to record from the login page of the web application. It states to check the developer console for details but I’m not sure what that is referring to since I didn’t see any logs in Chrome’s console at all.

I’d like to know if it’s something I’m doing wrong or if xk6-browser doesn’t support recording the logging into an application, because the issue I face when I finish the recording and go to run the test, all actions will fail because it’s not authenticated to perform any of the actions it recorded. I tried adding a request to grab a token in the Builder before those actions are taken, but I don’t see a way to take output from one request and use it in another one, so that’s led me to make this post since I would really like to use this tool and take it further than I’ve been able to.

Below is a gif of the behavior I’m experiencing:
FC0hCmaeib

So just to update this ticket, it appears it may have been related to my current Chrome revision, my company doesn’t allow us to update whenever we want, so I downloaded Chrome Beta to see if I could get it working there. Thankfully I was able to get it to work on the beginning login page for my application but unfortunately it was not automatically including anything in the subsequent requests to make them “authenticated” requests. I reached out to a developer and it appears that once logged in the application does not use an authentication header like I thought it would, although manually adding it still seems to work.

1 Like

The k6 browser recorder is for protocol level only. There isn’t a browser recorder for xk6. I’ve heard it mentioned that the scripting is more like playwright. You could record your scripts using playwright and then convert them, manually to xk6.

2 Likes