webview_find_element
[Tauri Apps Only] Find elements in a running Tauri app's webview and return their geometry, text, accessible name, attributes, visibility, and optionally their computed styles.
Instructions
[Tauri Apps Only] Find elements in a running Tauri app's webview and return their geometry, text, accessible name, attributes, visibility, and optionally their computed styles. Supports CSS selectors (default), XPath expressions, and text content matching via the strategy parameter. The "text" strategy searches element text content (not just direct text nodes), prefers exact matches over substring matches, prefers innermost elements, and prefers interactive ancestors. Returns structured JSON with totalMatches, returned count, and array of matches each containing: nth index, ref ID, tag, trimmed text, accessible name, attributes, bounding rect, visibility, interactability, optional computed styles, and optional truncated outerHTML. Use this instead of webview_execute_js for querySelector, getBoundingClientRect, textContent, and getComputedStyle reads. Requires active driver_session. Targets the only connected app, or the default app if multiple are connected. Specify appIdentifier (port or bundle ID) to target a specific app. For browser pages or documentation sites, use Chrome DevTools MCP instead.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| nth | No | Zero-based index to pick one of several matching elements. Omit when the selector is unique. Required when a text selector matches more than one visible element. | |
| limit | No | Maximum number of matches to return. Total match count is always reported. | |
| selector | Yes | The selector to find: CSS selector (default), XPath expression, text content, or ref ID (e.g., "ref=e3"). Interpretation depends on strategy. | |
| strategy | No | Selector strategy: "css" (default) for CSS selectors, "xpath" for XPath expressions, "text" to find elements by text content, with fallback to placeholder, aria-label, and title attributes. Ref IDs (e.g., "ref=e3") work with any strategy. | css |
| windowId | No | Window label to target (defaults to "main") | |
| properties | No | Computed CSS properties to include for each match, e.g. ["display","opacity","font-size"]. | |
| includeHtml | No | Include outerHTML for each match, truncated to 2000 characters. | |
| visibleOnly | No | Return only rendered elements. Set false to include display:none and off-screen nodes. | |
| appIdentifier | No | App port or bundle ID to target. Defaults to the only connected app or the default app if multiple are connected. |