Selenium/How-to/Debug with Visual Studio Code

EnvironmentsEdit

This tip works if you're targeting:

launch.jsonEdit

Create .vscode/launch.json file.

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "run select spec",
            "type": "node",
            "request": "launch",
            "args": ["tests/selenium/wdio.conf.js", "--spec", "${file}"],
            "cwd": "${workspaceFolder}",
            "autoAttachChildProcesses": true,
            "program": "${workspaceRoot}/node_modules/@wdio/cli/bin/wdio.js",
            "console": "integratedTerminal"
        }
    ]
}

Note: This file will work only with WebdriverIO v5 or above.

Make the browser visibleEdit

To make the browser visible, see Selenium/How-to/Make the browser visible.

Run Selenium testsEdit

Open a file in tests/selenium/specs folder in VSCode. Click Run > Start Debugging.

More informationEdit