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)
{
"headings": [{ "level": "h1", "text": "...", "truncated": true, "rawLength": 150 }],
"links": [{ "text": "...", "href": "...", "truncated": true }],
"buttons": [{ "text": "Submit", "disabled": false, "type": "submit" }],
"inputs": [{ "type": "text", "name": "email", "label": "Email", "value": "...", "required": true, "disabled": false }],
"images": [{ "alt": "...", "src": "...", "truncated": true }],
"landmarks": [],
"counts": {}
}

The count parameters above are forwarded to the content script. String caps are: heading text 100 characters; link text 50 and href 100; button text 50; input values 50; image alt text and source 100 each. When a non-sensitive value exceeds its cap, its object includes truncated: true; heading objects also include rawLength.

Password input values are always returned as '***'. Password objects never include truncated or raw-length metadata, so the password length is not leaked.

Buttons return { text, disabled, type }; they do not return a selector. Inputs return { type, name, label, value, required, disabled }, and label falls back through aria-label, placeholder, and an associated <label>.

const compact = await firefox_get_page_state({
tabId: 42,
maxHeadings: 10,
maxLinks: 10,
maxButtons: 5,
maxInputs: 5,
maxImages: 3
});

The counts object reports shown and total items for each collection. These collection limits are independent from the character caps.


Get detailed information about a specific element, including attributes, computed styles, visibility, and position. The returned text property is capped at 500 characters.

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
});

The element response includes attributes, computed styles, bounding rect, visibility state, and the capped text value.

  • 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.