Files
Phantom/archive/BROWSER_VISIBILITY.md
NW 863a67db8e config: full APAW agent infrastructure + Phantom project files
- Added all agent definitions (.kile/agents/*.md)
- Added commands, rules, skills, shared modules
- Added src/, scripts/, tests/, docker/, agent-evolution/
- Extracted 3 archives: website/, workspace/, release/
- Created .env with Gitea creds for UniqueSoft/Phantom
- Created docs/ with project-specific guides
- Added .gitignore for node_modules
2026-05-18 17:53:59 +01:00

2.0 KiB

Browser Visibility Configuration

By Default: Browser is VISIBLE (headed mode)

This allows you to observe browser actions in real-time during testing.

Configuration Options

Option 1: Visible Browser (Default for Development)

# Docker: Browser window visible
docker-compose up playwright-mcp

# Or directly:
npx @playwright/mcp@latest --browser chromium --no-sandbox
# (without --headless flag = visible window)

Option 2: Hidden Browser (For CI/CD)

Set environment variable:

export PLAYWRIGHT_MCP_HEADLESS=true

Or use flag:

npx @playwright/mcp@latest --headless --browser chromium --no-sandbox

Docker Setup for Visible Browser

Linux

# Allow Docker to access X11
xhost +local:docker

# Run with display
docker-compose up playwright-mcp

macOS

# Install XQuartz for X11
brew install --cask xquartz

# Start XQuartz
open -a XQuartz

# Allow connections
xhost +local:

# Run with display
docker-compose up playwright-mcp

Windows (WSL2)

# Install VcXsrv or use WSLg (Windows 11)
# Export display
export DISPLAY=$(cat /etc/resolv.conf | grep nameserver | awk '{print $2}'):0

# Run
docker-compose up playwright-mcp

Environment Variables

Variable Default Purpose
PLAYWRIGHT_MCP_HEADLESS false true = hidden, false = visible
PLAYWRIGHT_MCP_BROWSER chromium Browser to use
DISPLAY :0 X11 display for headed mode

Benefits of Headed Mode

  1. Observe Actions - Watch browser in real-time
  2. Debug Tests - See what's happening visually
  3. Learn - Understand how automation works
  4. Verify - Confirm correct behavior visually

When to Use Headless

For CI/CD pipelines or production testing where you don't need to see the browser:

# Set in CI environment
export PLAYWRIGHT_MCP_HEADLESS=true

# Or in docker-compose.override.yml
services:
  playwright-mcp:
    environment:
      - PLAYWRIGHT_MCP_HEADLESS=true