What is the best method to debug k6 browser script? Does setting breakpoints and step run works? Thanks.
Hi @rkaur1
Try a headful browser to view what it’s doing (“K6_BROWSER_HEADLESS=false”) and extra logging with “K6_BROWSER_DEBUG=true”; you can also use try/catch and log messages to the console.
Hi @rkaur1!
k6 still doesn’t have its own debugger. However, we can try running a k6 script in Node.js and utilize its debugger. There is a k6-debug-api npm module that implement most of the major k6 core api (including browser one). And there is a k6 plugin for IntelliJ platform that can launch k6 script via Node.js and start the debugger. This way you get all the functionality of a full-fledged debugger, including step-by-step execution and breakpoints. So if you are on IDEA or Webstorm
or any other IntelliJ IDE, you are welcome to give it a try.
Watch a video overview of k6 debugging with browser: https://youtu.be/liBSeXFwK-Q