Skip to content

Page Analysis

Fast, structured alternatives to screenshots for understanding page content. These tools return JSON data and require no mutex, making them ideal for multi-agent workflows.

Get structured page state as JSON. Returns headings, links, buttons, inputs, images, and landmarks with counts. Much faster than screenshots for understanding page content.

ParameterTypeDefaultDescription
tabIdnumberactive tabTarget tab ID
maxHeadingsnumber30Max headings to return
maxLinksnumber50Max links to return
maxButtonsnumber30Max buttons to return
maxInputsnumber30Max inputs to return
maxImagesnumber20Max images to return
timeoutnumber150000Request timeout in ms (5000-300000)
const state = await firefox_get_page_state({ tabId: 42 });
// Returns:
// {
// url, title, viewport,
// errors: [...],
// headings: [{ level, text }],
// links: [{ text, href }],
// buttons: [{ text, selector }],
// inputs: [{ type, name, value, placeholder }],
// images: [{ alt, src }],
// landmarks: [{ role, label }]
// }
// Limit results for large pages
const compact = await firefox_get_page_state({
tabId: 42,
maxLinks: 10,
maxButtons: 5
});
  • Prefer this over firefox_screenshot when you need to understand page structure without visual inspection.
  • Save the result to use with firefox_diff_page_state for change detection.

Get an accessibility tree snapshot. Returns the semantic structure of the page with roles, names, and states. Capped at 200 nodes by default.

ParameterTypeDefaultDescription
tabIdnumberactive tabTarget tab ID
maxDepthnumber5Maximum tree depth to traverse
maxNodesnumber200Maximum nodes to include (lower = faster)
selectorstringbodyCSS selector for root element
timeoutnumber150000Request timeout in ms (5000-300000)
// Full page accessibility tree
const tree = await firefox_get_accessibility_snapshot({ tabId: 42 });
// Focused snapshot of a specific section
const nav = await firefox_get_accessibility_snapshot({
tabId: 42,
selector: "nav.main-menu",
maxDepth: 3
});
  • Use selector to scope the snapshot to a specific region for faster results.
  • Lower maxNodes when you only need a high-level overview of the page structure.

Get detailed information about a specific element, including attributes, computed styles, visibility, and position.

ParameterTypeDefaultDescription
selectorstringrequiredCSS selector for the element
tabIdnumberactive tabTarget tab ID
timeoutnumber150000Request timeout in ms (5000-300000)
const info = await firefox_get_element({
selector: "#submit-btn",
tabId: 42
});
// Returns: attributes, computed styles, bounding rect, visibility state
  • Useful for debugging why a click or type command isn’t working (e.g., element is hidden or off-screen).
  • Check the bounding rect to verify the element is within the viewport.

Compare two getPageState snapshots to see what changed. Reports added, removed, and changed headings, links, buttons, and inputs. Useful for verifying that actions had the expected effect.

ParameterTypeDefaultDescription
beforeobjectrequiredFirst getPageState snapshot
afterobjectrequiredSecond getPageState snapshot
timeoutnumber150000Request timeout in ms (5000-300000)
// Capture state before an action
const before = await firefox_get_page_state({ tabId: 42 });
// Perform an action
await firefox_click({ selector: "button.load-more", tabId: 42 });
await firefox_wait_for({ selector: ".new-items", tabId: 42 });
// Capture state after
const after = await firefox_get_page_state({ tabId: 42 });
// Diff the two snapshots
const diff = await firefox_diff_page_state({ before, after });
// Returns: { added: {...}, removed: {...}, changed: {...} }
  • Combine with firefox_wait_for between snapshots to ensure the page has settled.
  • Useful for regression testing: capture a baseline, perform actions, and verify expected changes.