scan_page
Scan any open browser page to extract all element locators (XPath, CSS, testId) via CDP or Playwright WebSocket.
Instructions
Scan an open browser page and extract all element locators. Supports two connection modes: (1) cdpEndpoint — Chrome DevTools Protocol HTTP URL (e.g. http://localhost:9222). Requires Chrome launched with --remote-debugging-port=9222. Use this when @playwright/mcp is also connected to the same external Chrome. (2) wsEndpoint — Playwright WebSocket URL (e.g. ws://127.0.0.1:PORT/...). Use this if you have the browser WS endpoint from a Playwright browser server. Exactly one of cdpEndpoint or wsEndpoint must be provided. scanName determines the registry file: registry/{scanName}.json. scanMode: interactive (default), testId, or full.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| cdpEndpoint | No | CDP HTTP endpoint, e.g. http://localhost:9222. Use when Chrome was started with --remote-debugging-port. | |
| wsEndpoint | No | Playwright WS endpoint, e.g. ws://127.0.0.1:PORT/GUID. Use when connecting via Playwright browser server. | |
| pageUrl | No | URL substring to target a specific tab. Omit to use the first active page. | |
| scanName | Yes | Registry filename without .json, e.g. goal-side-panel-locators. | |
| scanMode | No | Element discovery mode: interactive (default), testId, or full. |