> ## Documentation Index
> Fetch the complete documentation index at: https://modal-computer-use.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Automate a browser

> Configure Chromium or Firefox in a Modal desktop and open a page.

Choose a browser image profile when the desktop needs Chromium or Firefox.

## Configure Chromium

```python theme={"system"}
from modal_computer_use import (
    BrowserConfig,
    ComputerConfig,
    ComputerSandbox,
    ResourceConfig,
)

config = ComputerConfig(
    resources=ResourceConfig(profile="browser"),
    browser=BrowserConfig(kind="chromium"),
)

with ComputerSandbox.create(config=config) as computer:
    result = computer.browser.open_url("https://example.com")
    if not result.ok:
        raise RuntimeError(result.message)

    screenshot = computer.screenshots.full()
    screenshot.save("example.png")
```

Set `kind="firefox"` to use Firefox.

## Prewarm the browser

Set `prewarm=True` when browser startup is part of a measured bottleneck:

```python theme={"system"}
from modal_computer_use import BrowserConfig, ComputerConfig, ResourceConfig

config = ComputerConfig(
    resources=ResourceConfig(
        profile="browser",
        cpu=4,
        memory_mib=8192,
    ),
    browser=BrowserConfig(kind="firefox", prewarm=True),
)
```

Prewarm starts the configured browser during desktop startup. It does not make a page ready for application use. Check the state that your task requires after you open the URL.

## Inspect browser state

```python theme={"system"}
status = computer.browser.status()
metrics = computer.browser.render_metrics(
    "https://example.com",
    timeout_seconds=30.0,
)
print(status)
print(metrics)
```

`status()` returns daemon browser state. `render_metrics()` opens the URL and returns the measured browser result. Render metrics require Chromium in version 1.1.0.

## Use desktop primitives

The browser namespace handles browser lifecycle operations. Use the normal input and observation namespaces for page interaction:

```python theme={"system"}
computer.mouse.click(320, 240)
computer.keyboard.hotkey("CTRL", "L")
computer.keyboard.type("https://example.com")
computer.keyboard.press("ENTER")
screenshot = computer.screenshots.full(show_cursor=True)
```

Keep provider model loops in your application. Modal Computer Use provides provider adapters, but the core package does not call model APIs.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.