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

+++ Sync API

```python
from camoufox.sync_api import Camoufox

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

+++ Async API

```python
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:**

---

## Device Rotation

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

=== os

**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.

```python
# 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:
    ...
```

=== fonts

**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.

[!ref Fonts & font fingerprinting](/fingerprint/fonts.md)

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

=== screen

**Type:** `Optional[Screen]`

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

!!!
While this sets the screen dimensions, it has very light impact on the size of the window. Sometimes the window will be larger, sometimes smaller.
!!!

```python
from browserforge.fingerprints import Screen

constrains = Screen(max_width=1920, max_height=1080)
with Camoufox(screen=constrains) as browser:
...
```

=== webgl_config

**Type:** `Optional[Tuple[str, str]]`

Use a specific WebGL vendor/renderer pair. Passed as a tuple of (vendor, renderer). The vendor & renderer combination must be supported for the target `os` or this will cause leaks.

Check [here](/webgl-research.md) for a list of Camoufox's supported vendor & renderer combinations.

```python
with Camoufox(
    webgl_config=("Apple", "Apple M1, or similar"),
    os="macos",
) as browser:
    ...
```

=== config

**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.

!!! warning
This is an advanced feature and should be used with caution. The Camoufox Python library is designed to populate these properties for you.
!!!

[!ref Passing config](/python/config.md)
===

---

## Configuration

Extra feature configuration and quality of life options.

=== humanize

**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.

[!ref Cursor movement info & demo](/fingerprint/cursor-movement.md)

```python
# 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:
    ...
```

=== headless

**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.

[!ref Virtual Display](/python/virtual-display.md)

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

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

=== addons

**Type:** `Optional[List[str]]`

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

To load an `.xpi` file, rename it to a `.zip` file, extract it, and pass the extracted folder.

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

=== exclude_addons

**Type:** `Optional[List[DefaultAddons]]`

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

[!ref Default addons](/fingerprint/addons.md#default-addons)

=== window

**Type:** `Optional[Tuple[int, int]]`

Set the window size in (width, height) pixels. This will also set the `window.screenX` and `window.screenY` properties to position the window at the center of the generated screen.

!!!
Camoufox will automatically generate a window size for you. Using a fixed window size can lead to fingerprinting. Do not set the window size to a fixed value unless for debugging purposes.
!!!

```python
with Camoufox(window=(1282, 955)) as browser:
    ...
```

=== main_world_eval

**Type:** `Optional[bool]`

Whether to inject scripts into the main world when prefixed with `mw:`

```python
with Camoufox(main_world_eval=True) as browser:
    page = browser.new_page()
    page.goto("https://example.com")
    # Modify the DOM
    page.evaluate("mw:document.querySelector('h1').remove()")
```

[!ref See more info](/python/main-world-eval.md)

=== enable_cache

**Type:** `Optional[bool]`

Whether to cache previous pages, requests, etc. Disabled by default as it uses more memory.

!!!
Keeping this disabled will not allow you to use the `page.go_back()` or `page.go_forward()` methods.
!!!

```python
with Camoufox(enable_cache=True) as browser:
    ...
```

=== persistent_context

**Type:** `Optional[bool]`

Whether to create a persistent context. Requires `user_data_dir`.

```python
with Camoufox(
    persistent_context=True,
    user_data_dir='/path/to/profile/dir',
) as context:
    ...
```
===

---

## Location & Language

Prevent proxy detection by matching your geolocation & locale with your target IP. This will populate the [Geolocation & Intl](/python/geoip.md) properties for you.

=== geoip

**Type:** `Optional[Union[str, bool]]`

Calculates 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.

[!ref Geolocation & Proxies](/python/geoip.md)

```python
# 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:
    ...
```

=== locale

**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.

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

# Generate a language based on the distribution of speakers the US
with Camoufox(locale="US") as browser:
    ...

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

---

## Toggles

Shortcuts for common Firefox preferences and security toggles.

=== block_images

**Type:** `Optional[bool]`

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

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

=== block_webrtc

**Type:** `Optional[bool]`

Blocks WebRTC entirely.

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

=== block_webgl

**Type:** `Optional[bool]`

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

```python
with Camoufox(block_webgl=True) as browser:
    ...
```

=== disable_coop

**Type:** `Optional[bool]`

Disables the Cross-Origin-Opener-Policy (COOP). This allows elements in `cross-origin` iframes, such as the Turnstile checkbox, to be clicked.

```python
# Cloudflare turnstile example
with Camoufox(disable_coop=True, window=(1280, 720)) as browser:
    page = browser.new_page()
    page.goto('https://nopecha.com/demo/cloudflare')
    page.wait_for_load_state(state="domcontentloaded")
    page.wait_for_load_state('networkidle')
    page.wait_for_timeout(5000)  # 5 seconds
    page.mouse.click(210, 290)
    ...

```

===

!!!
Camoufox will warn you if your passed configuration might cause leaks.
!!!

---

## More Usage Docs

[!ref Geolocation & Proxies](/python/geoip.md)
[!ref Virtual Display](/python/virtual-display.md)
[!ref Remote Server](/python/remote-server.md)
