Skip to content

Usage

Camoufox is a drop-in replacement for Playwright's browser launch call. Swap playwright.chromium.launch() for Camoufox() and your existing Playwright code runs unchanged.

Synchronous API

python
from camoufox.sync_api import Camoufox

with Camoufox() as browser:
    page = browser.new_page()
    page.goto("https://example.com")
    print(page.title())

Asynchronous API

python
import asyncio
from camoufox.async_api import AsyncCamoufox

async def main():
    async with AsyncCamoufox() as browser:
        page = await browser.new_page()
        await page.goto("https://example.com")
        print(await page.title())

asyncio.run(main())

Headless mode

python
from camoufox.sync_api import Camoufox

# Standard headless (works on Windows and macOS)
with Camoufox(headless=True) as browser:
    page = browser.new_page()
    page.goto("https://example.com")

# Virtual display headless (Linux, uses Xvfb)
with Camoufox(headless="virtual") as browser:
    page = browser.new_page()
    page.goto("https://example.com")

With a proxy and GeoIP matching

When you supply a proxy IP, the geoip parameter tells Camoufox to automatically set locale and timezone to match that IP. This keeps the fingerprint consistent with the proxy geography.

python
from camoufox.sync_api import Camoufox

with Camoufox(
    headless=True,
    geoip="203.0.113.0",   # your actual proxy IP
    proxy={
        "server": "http://proxy-host:port",
        "username": "user",
        "password": "pass"
    }
) as browser:
    page = browser.new_page()
    page.goto("https://example.com")

Notes

  • Fingerprint parameters (OS, device, fonts, screen size, addons) are randomized automatically on each Camoufox() call unless you pass explicit overrides.
  • The API surface is Playwright-compatible: browser.new_page(), page.goto(), page.click(), page.fill(), page.screenshot(), etc. all work as-is.
  • Always use with / async with context managers so the browser binary is cleaned up on exit.