import{_ as e,o,c as r,ag as a}from"./chunks/framework.CAXxHpAX.js";const p=JSON.parse('{"title":"Browser Contexts","description":"","frontmatter":{},"headers":[],"relativePath":"getting-started/browser.md","filePath":"getting-started/browser.md","lastUpdated":1774787421000}'),s={name:"getting-started/browser.md"};function i(n,t,l,d,c,h){return o(),r("div",null,[...t[0]||(t[0]=[a('

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:


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:
  4. Click Create.

Configuring a Browser Context

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

FieldDescription
NameThe display name shown in the UI.
CoreBrowser engine: chromium (default) or firefox.
Viewport WidthBrowser viewport width in pixels.
Viewport HeightBrowser viewport height in pixels.
User AgentOptional custom browser user agent string.
Device Scale FactorOptional device pixel ratio.
LocaleOptional locale such as en-US or zh-CN.
Timezone IDOptional timezone such as UTC or Asia/Shanghai.
Is MobileEnables mobile-style browser behavior.
Ignore HTTPS ErrorsAllows navigation to sites with invalid HTTPS certificates.

Managing Contexts


Assigning a Browser Context to a Bot

  1. Navigate to the Bots page and open your bot.
  2. Go to the General 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:

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


Browser Core Selection

Memoh's browser image can include Chromium, Firefox, or both. The available cores are determined at build time by the BROWSER_CORES build argument.

The install script prompts for browser core selection during setup. To rebuild manually with specific cores:

bash
BROWSER_CORES=chromium docker compose --profile browser build browser

Valid values for BROWSER_CORES: chromium, firefox, chromium,firefox (default).


Next Steps

',36)])])}const b=e(s,[["render",i]]);export{p as __pageData,b as default};