Skip to content

Page Interaction

Tools for interacting with page content. All page interaction tools work on background tabs and support a tabId parameter to target a specific tab.

Get the text content of a page or a specific element. HTML is excluded by default and text is truncated at 50K characters.

ParameterTypeDefaultDescription
tabIdnumberactive tabTarget tab ID
selectorstringCSS selector to extract content from a specific element
includeHtmlbooleanfalseInclude raw HTML in response (can be very large)
maxLengthnumber50000Max text length before truncation
timeoutnumber150000Request timeout in ms (5000-300000)
// Get full page text
const page = await firefox_get_content({ tabId: 42 });
// Returns: { url, title, text }
// Get text from a specific element
const article = await firefox_get_content({
tabId: 42,
selector: "article.main-content"
});
  • Use selector for focused extraction instead of increasing maxLength.
  • Set includeHtml: true only when you need to inspect markup structure.

Click an element by CSS selector.

ParameterTypeDefaultDescription
selectorstringrequiredCSS selector for the element to click
tabIdnumberactive tabTarget tab ID
timeoutnumber150000Request timeout in ms (5000-300000)
await firefox_click({ selector: "button.submit", tabId: 42 });
// Returns: { text, id, className } of the clicked element
  • If a click triggers navigation, follow up with firefox_wait_for to confirm the page loaded.
  • Use specific selectors (#login-btn) over generic ones (button) when multiple matches exist.

Type text into an input field. Compatible with React and Angular controlled inputs.

ParameterTypeDefaultDescription
selectorstringrequiredCSS selector for the input element
textstringrequiredText to type into the input
tabIdnumberactive tabTarget tab ID
clearbooleantrueClear existing text before typing
timeoutnumber150000Request timeout in ms (5000-300000)
// Type into a search box
await firefox_type({
selector: "input[name='search']",
text: "Claude Code",
tabId: 42
});
// Append to existing text
await firefox_type({
selector: "#notes",
text: " additional text",
clear: false
});

Send a keyboard event. More reliable than clicking for form submission and keyboard navigation.

ParameterTypeDefaultDescription
keystringrequiredKey to press (see supported keys below)
tabIdnumberactive tabTarget tab ID
selectorstringCSS selector for target element (default: focused element)
ctrlKeybooleanfalseHold Ctrl key
shiftKeybooleanfalseHold Shift key
altKeybooleanfalseHold Alt key
metaKeybooleanfalseHold Meta/Cmd key (Mac)
timeoutnumber150000Request timeout in ms (5000-300000)

Enter, Tab, Escape, Backspace, Delete, ArrowUp, ArrowDown, ArrowLeft, ArrowRight, Home, End, PageUp, PageDown, and single characters (a-z, 0-9).

// Submit a form
await firefox_press_key({ key: "Enter", tabId: 42 });
// Select all text
await firefox_press_key({ key: "a", ctrlKey: true });
// Focus a specific element and press Escape
await firefox_press_key({ key: "Escape", selector: ".modal" });

Capture a screenshot with dynamic page readiness detection. Automatically waits for network idle and render settlement before capture. Requests are serialized via mutex to prevent tab-switching collisions.

ParameterTypeDefaultDescription
tabIdnumberactive tabTab to capture (switches to it)
purposestringread-textQuality preset (see below)
qualitynumber60JPEG quality 1-100 (overrides preset)
scalenumber0.5Resolution scale 0.25-1.0 (overrides preset)
formatstringjpegImage format: jpeg or png
maxWaitnumber10000Max ms to wait for page readiness
waitForImagesbooleantrueWait for images/fonts to load
skipReadinessbooleanfalseSkip readiness detection (instant capture)
annotatebooleanfalseOverlay numbered badges on interactive elements
timeoutnumber150000Request timeout in ms (5000-300000)
PresetQualityScaleUse case
quick-glance300.25Layout and navigation confirmation
read-text600.5Reading content (default)
inspect-ui800.75UI details and small text
full-detail951.0Pixel-perfect inspection
// Default screenshot
const shot = await firefox_screenshot({ tabId: 42 });
// Returns: { tabId, dataUrl, readiness: { waitMs, timedOut, timeline } }
// Annotated screenshot for element identification
const annotated = await firefox_screenshot({
tabId: 42,
annotate: true,
purpose: "inspect-ui"
});
// Returns labels map: { 1: { selector, text, role }, 2: ... }
// Fast capture of a known-ready page
await firefox_screenshot({ tabId: 42, skipReadiness: true });
  • Use firefox_get_page_state instead when you only need structured data — it is much faster and uses no mutex.
  • The annotate option is useful for vision models to reference elements by number.
  • If you get a MUTEX_BUSY error, another agent is mid-screenshot. Retry after a short delay or use getPageState.

Scroll to an element or position on the page.

ParameterTypeDefaultDescription
tabIdnumberactive tabTarget tab ID
selectorstringCSS selector to scroll to
xnumberX coordinate to scroll to
ynumberY coordinate to scroll to
behaviorstringsmoothScroll behavior: smooth or instant
timeoutnumber150000Request timeout in ms (5000-300000)
// Scroll to an element
await firefox_scroll({ selector: "#footer", tabId: 42 });
// Scroll to top instantly
await firefox_scroll({ x: 0, y: 0, behavior: "instant" });

Wait for a condition on the page. Supports waiting for a CSS selector, body text, or URL match. Only one condition can be specified per call.

ParameterTypeDefaultDescription
tabIdnumberactive tabTarget tab ID
selectorstringCSS selector to wait for
textstringWait until body text contains this string
urlstringWait until URL matches this glob pattern
timeoutnumber10000Maximum time to wait in ms
// Wait for a loading spinner to disappear and content to appear
await firefox_wait_for({ selector: ".results-loaded", tabId: 42 });
// Wait for navigation after form submit
await firefox_wait_for({ url: "**/dashboard", timeout: 15000 });
// Wait for dynamic text content
await firefox_wait_for({ text: "Order confirmed", tabId: 42 });
  • Only one of selector, text, or url can be used per call.
  • Useful after firefox_click or firefox_navigate to wait for the page to settle.
  • The url parameter supports glob patterns (e.g., **/dashboard).