0

I'm using MSTest with Playwright in Visual Studio, and am having trouble with a selector. I want to debug using Playwright dev tools, Playwright inspector, etc. This page https://playwright.dev/docs/debug-selectors#using-playwright-inspector suggests setting PWDEBUG=1 or PWDEBUG=console. All the examples show running tests using VS Code, or command line test execution. I'm using Visual Studio 2022 with Test Explorer. Where do I set these variables?

I've tried:

  • Using the debug settings environment variables (nothing happens)
  • Creating a .runsettings file with the following contents:
<?xml version="1.0" encoding="utf-8" ?>
<RunSettings>
  <EnvironmentVariables>
      <PWDEBUG>1</PWDEBUG>
  </EnvironmentVariables> 
</RunSettings>

Then I used Test -> Configure Run Settings to select this file.

Still no debug console.

What am I missing?

Tony Isaac
  • 1,546
  • 1
  • 9
  • 6

1 Answers1

0

I take this approach: https://playwright.dev/docs/debug#browser-developer-tools

Just add page.pause() before the step where you need that selector and it will pause execution and allow you to debug

senaid
  • 534
  • 2
  • 8