browser_search
Search page elements by text, regex, role, aria-label, or CSS selector. Returns results sorted by confidence for precise targeting and interaction.
Instructions
Grep-like element search across the current page. by: 'text' (literal substring), 'regex', 'role', 'ariaLabel', 'selector' (CSS). Returns results[] sorted by confidence descending — pass results[0].selector to browser_click. Pagination via offset/maxResults. Caveats: Use browser_overview for broad discovery; use browser_search when you know specific text or role to target.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| by | Yes | Search axis: text/regex/role/ariaLabel/selector | |
| pattern | Yes | Pattern to match against the chosen axis. | |
| scope | No | CSS selector to limit the search scope. | |
| maxResults | No | Max results returned (default 50). | |
| offset | No | Offset into the result set (default 0). | |
| visibleOnly | No | Only visible elements (default true). Set false to include hidden ones with confidence penalty. | |
| inViewportOnly | No | Only currently-in-viewport elements (default false). | |
| caseSensitive | No | Case-sensitive matching for text/regex (default false). | |
| tabId | No | Tab ID from browser_open. Omit to use the first page tab. | |
| port | No | Chrome/Edge CDP remote debugging port. | |
| include | No | Optional response-shape opt-in. `['envelope']` returns the self-documenting envelope (`_version` / `data` / `as_of` / `confidence`). `['raw']` forces raw shape (overrides DESKTOP_TOUCH_ENVELOPE=1 server default). Default behaviour is raw shape (compat with existing clients). |