Selector Debugging

Important

TestCafe v2.4.0 introduced the Visual Selector Debugger — a new way to interactively generate and debug Selector queries.

Enter a Selector query

Warning

This article describes an experimental capability. Feel free to try it out and share your feedback with the TestCafe team. Do not use experimental capabilities for business-critical tasks — you may encounter bugs and lack of stability.

If you launch TestCafe with the --experimental-debug flag, you can debug Selectors and Client Functions in the Watch panel of a Node.js debugger.

Quick Guide (VSCode)

  1. Add a breakpoint to your test with the t.debug action.
  2. Run the test with the --experimental-debug flag:

        testcafe chrome index.js --experimental-debug
    

    TestCafe outputs the Debugger URL to the Console when you launch the test.

    Debug URL

  3. In Visual Studio Code, open the “Run” menu and click “Start Debugging”.

  4. Click the “Debug URL” button in the “Run and Debug” pane and input the URL from the command line.

    VSCode debugger sidebar

  5. Use the Watch panel of the Node.JS debugger to evaluate Selectors and Client functions.