'How to debug playwright in Windows 10?
I've tried to debug like descript in docu:
Windows with cmd.exeset PWDEBUG=consolenpm run test
Windows with PowerShell$env:PWDEBUG="console"npm run test
Therefore I've tried in ubuntu:
PWDEBUG=console npm run test
This also doesn't work.
How is the right way to debug in Windows 10?
Next, I've tried the following command in ubuntu:
PWDEBUG=1 npx playwright test
This worked in Ubuntu but not in Windows 10
Solution 1:[1]
If you're using visual studio code the default terminal is powershell.
You can open this by going to menu bar: Terminal > New Terminal
If you're not using VS code, just open a new powershell window from the start menu.
You'll know it's powershell as the terminal line start with "PS".
You need to kick off the debugger with two lines. One to turn on the debugger and one to run the tests:
$env:PWDEBUG=1
npx playwright test --headed --browser=chromium
That second lines runs everything as I create this folder with just 1 test file. Refer to the CLI if you want to run a specific tests
VS Code with the terminal window looks like this:

When you run the second line that opens the playwright inspector to allow you to debug:

Solution 2:[2]
one liner works for me from VSCode terminal:
set $env:PWDEBUG=1 && npx playwright test --headed --browser=chromium
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | RichEdwards |
| Solution 2 |
