get_page_elements
Retrieve elements from a web page using CSS selectors, returning their attributes like tag, text, and visibility. Supports sessions or direct URLs.
Instructions
List elements matching a CSS selector with their attributes (tag, text, id, class, href, value, visible, enabled, aria_label, role). Pass 'attributes' for extra HTML attributes (data-, aria-, style, ...) and 'full_text' for complete text content instead of the 80-char preview. Works on a session or a URL. Standard CSS selectors only — Playwright-specific pseudo-classes (:has-text, :visible) are not supported here.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"selector": "<selector>"
},
"name": "get_page_elements"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| url | No | URL to open (use this or session_id) | |
| project | No | Project name (optional). With a project: runs in its shared, authenticated context. Without: runs in an isolated context (no shared cookies/login). | |
| selector | Yes | CSS selector to match elements | |
| full_text | No | Return full text content instead of an 80-char preview (default: false) | |
| attributes | No | Extra HTML attribute values to include per element (e.g. data-testid, aria-expanded, style) | |
| session_id | No | Session ID (use this or url) | |
| max_results | No | Max elements to return (default: 50) |