BoxLite

Browser Automation

Run browser automation in isolated, reproducible sandboxes

TL;DR

Browser automation is notoriously flaky and resource-hungry. BoxLite provides isolated micro-VMs where each browser instance runs in a clean environment with consistent behavior. No more "works on my machine" issues, no cross-test contamination, and strong isolation from potentially malicious web content.

Why Isolate Browser Automation?

Browser automation workloads have unique challenges:

  • State contamination: Cookies, localStorage, and cache can leak between tests
  • Resource conflicts: Multiple browser instances competing for memory and CPU
  • Security risks: Visiting untrusted URLs can expose your system to attacks
  • Reproducibility: Different OS configurations cause flaky tests

Supported Frameworks

Puppeteer

Google's Node.js library for Chrome/Chromium automation

Playwright

Microsoft's cross-browser automation with built-in parallelism

Selenium

Industry-standard WebDriver protocol support

Cypress

Modern E2E testing framework with time-travel debugging

How to Run Browsers in BoxLite

BoxLite provides a dedicated browser sandbox with Chrome DevTools Protocol (CDP) access:

import boxlite
from playwright.async_api import async_playwright

async def screenshot_url(url: str) -> bytes:
    # Start isolated browser sandbox
    async with boxlite.BrowserBox() as browser_box:
        cdp_url = browser_box.cdp_endpoint

        async with async_playwright() as p:
            browser = await p.chromium.connect_over_cdp(cdp_url)
            page = await browser.new_page()
            await page.goto(url)
            screenshot = await page.screenshot()
            return screenshot

Common Use Cases

Web Scraping

When scraping untrusted websites, malicious JavaScript could attempt to exploit browser vulnerabilities. BoxLite's VM isolation ensures any exploit is contained within the sandbox.

E2E Testing

Each test runs in a fresh VM with a clean browser state. No more flaky tests from leftover cookies or cached data. Tests are fully reproducible across environments.

Screenshot Services

Render URLs to images safely. Users can submit any URL without risking your infrastructure. Perfect for link previews, social cards, and PDF generation.

Parallel Testing

Spin up multiple browser sandboxes in parallel. Each has isolated resources and network, eliminating interference between concurrent tests.

Why Not Just Use Docker?

Docker containers share the host kernel. A browser exploit combined with a container escape could compromise your host. BoxLite's VM boundary provides much stronger isolation—even kernel exploits are contained.

Learn more about BoxLite vs Docker →

Ready to isolate your browser automation?

Get started with BoxLite's browser sandboxes.