query
Query the page DOM using CSS selectors to extract elements with tag, attributes, and text content. Supports advanced selectors including pseudo-classes, combinators, and attribute matchers for precise targeting.
Instructions
Run a CSS selector against the current page's parsed DOM. Returns matching elements as [{ref, tag, attrs, text, text_chars, text_truncated}]. Element refs (e:NN) are stable handles for use with click/type/submit. Selector engine supports tag, id, class, attribute matchers (=, ^=, $=, *=, ~=), all four combinators (descendant, >, +, ~), pseudo-classes (:first/last/nth-child including An+B formulas, :first/last/nth-of-type, :only-child/of-type), :not(), and :has().
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| selector | Yes | CSS selector |