Skip to content

RedHatQE/playwright-images

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

43 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Playwright with VNC: Headed Browser Docker Images

Official Playwright images from Microsoft are excellent for CI/CD pipelines and pure headless execution. However, they lack a graphical user interface.

This project solves that problem by providing a lightweight, VNC-enabled environment.

Images are available in two bases:

  • Bookworm (Debian) - Smallest images
  • UBI9 (Red Hat) - Enterprise-ready

Key Features

  • VNC Server Built-in: Connect with any VNC client to view and interact with the browser
  • Headed Mode by Default: Designed specifically for running browsers with their UI visible
  • Dual-Base Support: Choose Debian Bookworm or Red Hat UBI9
  • Multiple Browser Variants: Build tailored images for Firefox, Chromium, or Google Chrome (Bookworm only)
  • All-in-One Image: An all variant includes Firefox + Chromium (+ Chrome for Bookworm)
  • Optimized for Size: Multi-stage Dockerfile and careful package selection to keep images lean
  • Configurable: Control the browser type and headless mode at runtime with environment variables
  • Automated Builds: Daily CI/CD pipeline builds latest Playwright versions automatically

🚀 Quick Start

# Bookworm Firefox (smallest - 994 MB)
docker run -p 5900:5900 -p 3000:3000 digitronik/playwright-vnc:bookworm-firefox-latest

# UBI9 all browsers (enterprise)
docker run -p 5900:5900 -p 3000:3000 digitronik/playwright-vnc:ubi9-latest

# Connect via VNC
vncviewer localhost:5900

See Releases for version history and Docker Hub for all available tags.

How to Build Images Locally

Note: Images are automatically built daily via GitHub Actions. For local development:

# Build all Bookworm variants (default)
./build.sh

# Build all UBI9 variants
./build.sh --base ubi9

# Build specific browsers
./build.sh firefox chrome
./build.sh --base ubi9 firefox  # Chrome not available for ubi9

# Build with specific Playwright version
./build.sh --playwright-version 1.58.0

Available Image Variants

Base Image Tag Default Browser Installed Browsers
Bookworm :bookworm-latest Chromium Firefox, Chromium, Chrome
Bookworm :bookworm-firefox-latest Firefox Playwright's Firefox
Bookworm :bookworm-chromium-latest Chromium Playwright's Chromium
Bookworm :bookworm-chrome-latest Google Chrome Google Chrome (Stable)
UBI9 :ubi9-latest Chromium Firefox, Chromium
UBI9 :ubi9-firefox-latest Firefox Playwright's Firefox
UBI9 :ubi9-chromium-latest Chromium Playwright's Chromium

Note: Google Chrome is not available for UBI9 images due to RPM signing policy restrictions.

How to Run the Images

Use docker/podman to start a container. Map VNC port (5900) and Playwright server port (3000).

# Run specific browser image
docker run -p 5900:5900 -p 3000:3000 digitronik/playwright-vnc:bookworm-firefox-latest

# Run UBI9 all-browsers image with specific browser selection (firefox or chromium)
docker run -e PW_BROWSER="firefox" -p 5900:5900 -p 3000:3000 quay.io/redhatqe/playwright-vnc:ubi9-latest

# Run in headless mode  
docker run -e PW_HEADLESS="true" -p 3000:3000 digitronik/playwright-vnc:bookworm-firefox-latest

Environment Variables

  • PW_BROWSER: Specify browser (firefox, chromium, chrome) - Chrome only available for Bookworm
  • PW_HEADLESS: Run in headless mode (true/false, default: false)

Connecting with a VNC Client

VNC will run at port 5900. You can connect your favorite VNC client.

vncviewer localhost:5900 

Connecting with a Playwright Client

Chromium or Chrome

from playwright.sync_api import sync_playwright

with sync_playwright() as p:
    browser = p.chromium.connect("ws://localhost:3000/playwright")
    print("Connected to Chromium!")
    page = browser.new_page()
    page.goto("https://playwright.dev/")
    print(page.title())
    browser.close()

Firefox

from playwright.sync_api import sync_playwright

with sync_playwright() as p:
    browser = p.firefox.connect("ws://localhost:3000/playwright")
    print("Connected to Firefox!")
    page = browser.new_page()
    page.goto("https://playwright.dev/")
    print(page.title())
    browser.close()

Testing

Run comprehensive pytest test suite:

pip install -r tests/requirements.txt
pytest tests/ -v

See tests/README.md for details.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors