Map Interactive Elements
operagx_map_elementsMaps page elements to numeric IDs and draws numbered badges, enabling targeted clicks and typing in browser automation.
Instructions
Scans the page for clickable/fillable elements (links, buttons, inputs, selects, ARIA widgets) and returns each with a small integer id, role, text, CSS selector, and viewport coordinates.
By default it also draws numbered badges on the live page — call the base connector's
screenshot tool right after this to visually ground the ids, then reference them as
elementId in operagx_click / operagx_type_text / etc. Call operagx_clear_annotations when
done looking, so the badges don't linger in future screenshots.
Args:
tabId / tabIndex / matchUrl / matchTitle (optional): which tab to scan. Defaults to the first open tab.
annotate (boolean, default true): draw numbered overlay badges.
visibleOnly (boolean, default true): skip elements outside the viewport or CSS-hidden.
limit (number, default 100, max 500): cap on elements returned, to avoid overwhelming context on dense pages.
Returns: { "count": number, // elements actually returned (<= limit) "totalFound": number, // elements matched before truncation "truncated": boolean, // true if totalFound > count "elements": [ { "id": number, // pass this as elementId to other tools "tag": string, // e.g. "input", "button", "a" "role": string | null, // ARIA role, if set "text": string, // visible text / placeholder / aria-label, truncated to 120 chars "selector": string, // CSS selector (fallback addressing) "rect": { "x": number, "y": number, "width": number, "height": number }, "center": { "x": number, "y": number }, "attributes": { [name: string]: string } // id/class/name/type/role/placeholder/aria-label/value/href } ] }
Examples:
Use when: "click the login button" -> map_elements first to find its id, then operagx_click with that elementId.
Use when: a page has more interactive elements than the default limit -> re-call with a higher limit, or narrow with visibleOnly=true (default) to only what's on-screen.
Don't use when: you already have a fresh element map from a moment ago and the page hasn't changed — re-resolve selectors instead of re-scanning.
Error Handling:
Returns "No open tabs found..." if the browser has no open tabs — open one first.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No | Maximum elements to return (default 100, max 500). | |
| tabId | No | Tab id from operagx_list_tabs. Omit to use the first open tab. | |
| annotate | No | Draw numbered overlay badges on the live page for the next screenshot. | |
| matchUrl | No | Pick the tab whose URL contains this substring. | |
| tabIndex | No | Zero-based tab index, alternative to tabId. | |
| matchTitle | No | Pick the tab whose title contains this substring. | |
| visibleOnly | No | Skip elements outside the viewport or hidden via CSS display/visibility. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| count | Yes | ||
| elements | Yes | ||
| truncated | Yes | ||
| totalFound | Yes |