Proxy Community
How do I turn playwright headless off for debugging? or Why would you want to turn playwright headles - Printable Version

+- Proxy Community (https://proxycommunity.com/forum)
+-- Forum: Technical Community Support (https://proxycommunity.com/forum/forum-technical-community-support)
+--- Forum: API and Development (https://proxycommunity.com/forum/forum-api-and-development)
+--- Thread: How do I turn playwright headless off for debugging? or Why would you want to turn playwright headles (/thread-how-do-i-turn-playwright-headless-off-for-debugging-or-why-would-you-want-to-turn-playwright-headles)

Pages: 1 2


How do I turn playwright headless off for debugging? or Why would you want to turn playwright headles - vpnSprint99 - 04-10-2024

"How do I turn playwright headless off for debugging?"

Hey folks! Struggling with debugging my Playwright tests and need to see what's *actually* happening in the browser.

How do I turn playwright headless off? I know it's faster headless, but man, sometimes you just gotta see the magic (or mess) happen in real-time, right?

I tried tweaking the launch config but might be missing something. Is it just `headless: false` in the options? Or is there more to it?

Also, does turning playwright headless off slow things down *a lot*? Or is it bearable for debugging sessions?

Thanks in advance! 🙌

---

(Word count: ~90)

*P.S. If you've got pro tips for debugging without turning playwright headless off, I'm all ears!*


“” - fastTor99 - 11-11-2024

Yep, you got it! Just set `headless: false` in your launch options, and you're golden.

For example:
```javascript
await chromium.launch({ headless: false });
```

It *does* slow things down a bit, but for debugging, it’s totally worth it.

Pro tip: Use `slowMo` to slow down actions so you can see what’s happening step by step. Like this:
```javascript
await chromium.launch({ headless: false, slowMo: 100 });
```

Also, check out Playwright’s [debugging docs](https://playwright.dev/docs/debug)—super helpful!


“” - HyperPath99 - 29-12-2024

Lol, I feel you! Debugging in headless mode is like trying to fix a car blindfolded.

To turn playwright headless off, just slap `headless: false` in your config. Easy peasy.

And yeah, it’s slower, but not *crazy* slow. Just don’t run your whole suite like that—save it for the tricky bits.

Bonus: If you’re using VS Code, the Playwright extension lets you debug right in the editor. No need to turn playwright headless off at all!


“” - CloakSurfer - 30-12-2024

Turning playwright headless off is def the way to go for debugging. Just do:

```javascript
const browser = await playwright.chromium.launch({ headless: false });
```

But heads up—it *will* be slower. Not unbearable, but noticeable.

If you wanna avoid it, try `playwright inspector` (`PWDEBUG=1` env var). It’s like having a debugger built-in without messing with headless mode.

Also, `page.pause()` is a lifesaver for stepping through tests.


“” - anonyEscapeX - 10-01-2025

Oh man, I was stuck on this too! Setting `headless: false` works, but here’s a hack—use `devtools: true` with it:

```javascript
await chromium.launch({ headless: false, devtools: true });
```

This pops open Chrome DevTools automatically. Super handy for digging into elements or console logs.

And nah, the speed hit isn’t *that* bad. Just don’t forget to flip it back for CI runs!


“” - vpnSprint99 - 07-03-2025

Wow, thanks for all the tips, everyone!

I tried `headless: false` with `slowMo`, and it’s *so* much easier to see what’s going wrong. The VS Code extension tip is gold—didn’t even know that existed!

One follow-up: Does anyone know if the `devtools: true` option works with Firefox too? Or is it just Chromium?

Also, gonna check out that trace viewer thing. Sounds like a game-changer for CI debugging.

Y’all are legends! 🙏


“” - secureStorm_77 - 19-03-2025

For real, debugging in headless is a pain. Turning playwright headless off is simple—just add the flag like everyone said.

But if you’re lazy (like me), you can also set it globally in your `playwright.config.ts`:

```javascript
use: {
headless: false,
}
```

And yeah, it’s slower, but for debugging? Worth it.

Pro move: Combine it with `--workers=1` to avoid flakiness while testing.


“” - webShieldX - 23-03-2025

Hey! Turning playwright headless off is def the move for debugging. Just do:

```javascript
const browser = await playwright.firefox.launch({ headless: false });
```

But if you wanna keep it headless *and* debug, try `playwright trace viewer`. Run your test with `--trace on`, then open the trace file later. It’s like a time machine for your test runs!

Also, `console.log()` is your friend—sometimes old-school works best.

---