---
title: Browsers with their sandbox
description: Run Playwright, Puppeteer or Electron in a sandbox without turning the browser's own sandbox off.
order: 8
icon: globe-lock
tags: [browsers, testing]
related: [parallel-agents, port-forwarding, port-a-devcontainer]
---
import AgentPrompt from '../../components/AgentPrompt.astro';
import AgentPromptLink from '../../components/AgentPromptLink.astro';
## The problem
Chromium's sandbox needs user namespaces, which docker's default seccomp profile blocks, so people add `--no-sandbox` everywhere. devsandbox makes the browser sandbox work where it can, checks each new container, and tells the tools which case they are in.
<AgentPromptLink />
## Try it
No config needed. `run` and `devsandbox inspect web` print what the check found:
```text title="OUTPUT"
browser sandbox: on
```
Playwright turns Chromium's sandbox off by default, so launch it like this:
```js title="playwright"
const browser = await chromium.launch({
chromiumSandbox: !!process.env.DEVSANDBOX_BROWSER_SANDBOX,
executablePath: process.env.DEVSANDBOX_CHROME,
});
```
## How it works
- Docker sandboxes get docker's default seccomp profile plus user namespaces. Podman's default already allows them.
- Where the check passes, every `exec` gets `DEVSANDBOX_BROWSER_SANDBOX=1`. Where it fails, the tools' own sandbox-off variables are set instead.
- Where execs run as root, `DEVSANDBOX_CHROME` points at a wrapper that starts the browser as a non-root user.
- [`userns = false`](/docs/config#environment) keeps docker's default profile, with the browser sandbox off.
## Agent instructions
<AgentPrompt prompt="browsers" />