# Virtual Display

While Camoufox includes patches to prevent headless detection, running in headless mode may still be detectable in the future. It's recommended to use a virtual display buffer to run Camoufox headlessly.

If you are running Linux, and would like to run Camoufox headlessly in a virtual display, install xvfb:

sudo apt-get install xvfb
sudo pacman -S xorg-server-xvfb

# Confirm Xvfb is installed:

$ which Xvfb
/usr/bin/Xvfb

# Usage

Passing headless="virtual" will spawn a new lightweight virtual display in the background for Camoufox to run in.

from camoufox.sync_api import Camoufox

with Camoufox(
    headless="virtual"
) as browser:
    page = browser.new_page()
    page.goto("https://example.com")
from camoufox.async_api import AsyncCamoufox

async with AsyncCamoufox(
    headless="virtual"
) as browser:
    page = await browser.new_page()
    await page.goto("https://example.com")