set_locator
Add or replace a locator expression on a page object method for precise element targeting in Playwright automation.
Instructions
Add or replace a locator on a page object. selector is a Playwright locator-chain EXPRESSION -- the text that goes after "page." (or the assigned scope's own expression, if this method has one via set_method_scope) -- e.g. "getByRole('button', { name: 'Submit' })" or "locator('#submit')", never a bare selector-engine string. A ${paramName} block (bare names only, not expressions) inside one of the expression's own string-literal arguments becomes a parametric method automatically -- see extractPoParams.
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": {
"pageObject": "<pageObject>",
"method": "<method>",
"selector": "<selector>"
},
"name": "set_locator"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| method | Yes | ||
| project | No | Path to the project root (same folder the side panel connects to). Defaults to the EASYSPEC_PROJECT environment variable if omitted. | |
| selector | Yes | ||
| pageObject | Yes |