# Usage

Camoufox is fully compatible with your existing Playwright code. You only have to change your browser initialization:

from camoufox.sync_api import Camoufox

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

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

# Parameters List

All Playwright Firefox launch options are accepted, along with the following:

Camoufox will generate device information for you based on the following parameters.

Type: Optional[ListOrString]

Operating system to use for the fingerprint generation. Can be "windows", "macos", "linux", or a list to randomly choose from. By default, Camoufox will randomly choose from a list of all three.

# Use a specific OS
with Camoufox(os="windows") as browser:
    ...

# Randomly choose from a list of OS
with Camoufox(os=["windows", "macos", "linux"]) as browser:
    ...

Type: Optional[List[str]]

Fonts to load into Camoufox, in addition to the default fonts for the target os. Takes a list of font family names that are installed on the system.

Fonts & font fingerprinting
../../fingerprint/fonts/

custom_fonts = ["Arial", "Helvetica", "Times New Roman"]
with Camoufox(fonts=custom_fonts) as browser:
    ...

Type: Optional[Screen]

Constrains the screen dimensions of the generated fingerprint. Takes a browserforge.fingerprints.Screen instance.

from browserforge.fingerprints import Screen

custom_screen = Screen(width=1920, height=1080)
with Camoufox(screen=custom_screen) as browser:
...

Type: Optional[Dict[str, Any]]

If needed, individual Camoufox config properties can be overridden by passing them as a dictionary to the config parameter. This can be used to enable features that have not yet been implemented into the Python library.

Passing config
../config/

Extra feature configuration and quality of life options.

Type: Optional[Union[bool, float]]

Humanize the cursor movement. Takes either True, or the MAX duration in seconds of the cursor movement. The cursor typically takes up to 1.5 seconds to move across the window.

Cursor movement info & demo
../../fingerprint/cursor-movement/

# Enable humanization with default settings
with Camoufox(humanize=True) as browser:
    ...

# Set a custom max duration for cursor movement
with Camoufox(humanize=2.0) as browser:
    ...

Type: Optional[Union[bool, Literal['virtual']]]

Whether to run the browser in headless mode. Defaults to False. If you are running linux, passing 'virtual' will use Xvfb.

Virtual Display
../virtual-display/

# Run in headless mode
with Camoufox(headless=True) as browser:
    ...

# Run in headless mode on linux
with Camoufox(headless="virtual") as browser:
    ...

Type: Optional[List[str]]

List of Firefox addons to use. Must be paths to extracted .xpi files.

addons = ["/path/to/addon1", "/path/to/addon2"]
with Camoufox(addons=addons) as browser:
    ...

Type: Optional[List[DefaultAddons]]

Exclude the default addons. Passed as a list of camoufox.DefaultAddons enums.

Default addons
../../fingerprint/addons/#default-addons

Prevent your proxy from not matching your target geolocation and locale. This will populate the Geolocation & Intl properties for you.

Type: Optional[Union[str, bool]]

Calculate longitude, latitude, timezone, country, & locale based on the IP address. Pass the target IP address to use, or True to find the IP address automatically.

Geolocation & Proxies
../geoip/

# Use a specific IP address
with Camoufox(geoip="203.0.113.0", proxy=...) as browser:
    ...

# Automatically find the IP address
with Camoufox(geoip=True, proxy=...) as browser:
    ...

Type: Optional[Union[str, List[str]]]

Locale(s) to use in Camoufox. Can be a list of strings, or a single string separated by a comma. The first locale in the list will be used for the Intl API.

# Use a single locale
with Camoufox(locale="en-US") as browser:
    ...

# Use multiple locales
with Camoufox(locale=["en-US", "fr-FR", "de-DE"]) as browser:
    ...

# Use multiple locales as a comma-separated string
with Camoufox(locale="en-US,fr-FR,de-DE") as browser:
    ...

Shortcuts for common Firefox preferences and security toggles.

Type: Optional[bool]

Blocks all requests to images. This can help save your proxy usage.

with Camoufox(block_images=True) as browser:
    ...

Type: Optional[bool]

Blocks WebRTC entirely.

with Camoufox(block_webrtc=True) as browser:
    ...

Type: Optional[bool]

Whether to allow WebGL. To prevent leaks, only use this for special cases.

with Camoufox(allow_webgl=True) as browser:
    ...


# More Usage Docs

Geolocation & Proxies
../geoip/
Virtual Display
../virtual-display/
Remote Server
../remote-server/