query_selector
Test CSS selectors and receive detailed element info: tag, position, visibility status, and interaction capability. Shows hidden reasons and supports testid shortcuts for efficient debugging.
Instructions
Test a selector and return detailed information about all matched elements. Essential for selector debugging and finding the right element to interact with. Returns compact text format with element tag, position, text content, visibility status, and interaction capability. Shows why elements are hidden (display:none, opacity:0, zero size). Supports testid shortcuts (e.g., 'testid:submit-button'). Use limit parameter to control how many matches to show (default: 10). NEW: Use onlyVisible parameter to filter results (true=visible only, false=hidden only, undefined=all).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| selector | Yes | CSS selector, text selector, or testid shorthand to test (e.g., 'button.submit', 'testid:login-form', 'text=Sign In', 'dialog::button' to scope the lookup to the topmost open dialog/sheet) | |
| limit | No | Maximum number of elements to return detailed info for (default: 10, recommended max: 50) | |
| onlyVisible | No | Filter results by visibility: true = show only visible elements, false = show only hidden elements, undefined/not specified = show all elements (default: undefined) | |
| showAttributes | No | Comma-separated list of HTML attributes to display for each element (e.g., 'id,name,aria-label,href,type'). If not specified, attributes are not shown. |