suggestSelectors
Suggests testing-library selectors for a DOM element, prioritizing accessible role, label, text, placeholder, and test ID queries to create maintainable tests.
Instructions
Suggest testing-library selectors for a DOM element. Prioritizes accessible selectors (role > label > text > placeholder > testid).
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": {
"tagName": "<tagName>"
},
"name": "suggestSelectors"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | No | The name attribute (for form elements) | |
| role | No | The ARIA role attribute | |
| testId | No | The data-testid attribute | |
| tagName | Yes | The HTML tag name (e.g., "button", "input", "div") | |
| ariaLabel | No | The aria-label attribute | |
| placeholder | No | The placeholder attribute (for inputs) | |
| textContent | No | Visible text content inside the element |