Skip to content

# Browser Contexts ​

Memoh can give a bot access to a headless browser through the Browser Gateway. A Browser Context stores the browser environment a bot should use, such as viewport size, locale, timezone, and mobile behavior.

Once a browser context is assigned to a bot, the bot can use browser tools to open pages, click elements, fill forms, capture screenshots, and inspect page content.

## Concept: Browser Gateway ​

The Browser Gateway is powered by Playwright and provides browser automation for bots. In practice, a browser context acts like a reusable browser profile configuration for one or more bots.

Typical use cases include:

- Navigating websites
- Clicking buttons and links
- Filling and submitting forms
- Reading rendered page content
- Capturing screenshots or PDFs

## Creating a Browser Context ​

Manage contexts from the Browser Contexts page in the sidebar.

1. Navigate to the Browser Contexts page.
2. Click Add Browser Context.
3. Fill in the following field:
   - Name: A display name for this browser context.
4. Click Create.

## Configuring a Browser Context ​

After creating a context, select it from the sidebar and update its settings.

Field | Description
--- | ---
Name | The display name shown in the UI.
Viewport Width | Browser viewport width in pixels.
Viewport Height | Browser viewport height in pixels.
User Agent | Optional custom browser user agent string.
Device Scale Factor | Optional device pixel ratio.
Locale | Optional locale such as `en-US` or `zh-CN`.
Timezone ID | Optional timezone such as `UTC` or `Asia/Shanghai`.
Is Mobile | Enables mobile-style browser behavior.
Ignore HTTPS Errors | Allows navigation to sites with invalid HTTPS certificates.

### Managing Contexts ​

- Edit: Select a context and update its configuration.
- Delete: Remove a context you no longer use.

## Assigning a Browser Context to a Bot ​

1. Navigate to the Bots page and open your bot.
2. Go to the Settings tab.
3. Find the Browser Context dropdown.
4. Select the context you created.
5. Click Save.

After saving, the bot can use that browser context when browser tools are invoked.

## Bot Interaction ​

When a browser context is configured, the bot can use built-in browser tools such as:

- `browser_action`: perform actions like navigation, click, fill, select, scroll, tab management, screenshot, or PDF export
- `browser_observe`: inspect the current page and gather information for the model

This lets the bot interact with real websites instead of relying only on static HTML or search results.

## Next Steps ​

- If you have not configured memory yet, continue with Built-in Memory Provider.
- To manage a bot's long-term knowledge after setup, see Bot Memory Management.