Summary - The `--exact` flag on `find role`, `find label`, and `find placeholder` was accepted by the CLI but silently dropped by the server. The Zod validation schema, TypeScript types, and action handlers all lacked the `exact` field, so it was stripped before reaching Playwright's `getByRole`, `getByLabel`, and `getByPlaceholder` calls. - Added `exact` to the schema, types, and handler for all three locators so the flag is forwarded to Playwright as intended. - Added tests confirming `exact: true` survives protocol parsing for `getbyrole`, `getbylabel`, and `getbyplaceholder`. Fixes #402
This commit is contained in:
+3
-3
@@ -887,7 +887,7 @@ async function handleGetByRole(
|
||||
browser: BrowserManager
|
||||
): Promise<Response> {
|
||||
const page = browser.getPage();
|
||||
const locator = page.getByRole(command.role as any, { name: command.name });
|
||||
const locator = page.getByRole(command.role as any, { name: command.name, exact: command.exact });
|
||||
|
||||
switch (command.subaction) {
|
||||
case 'click':
|
||||
@@ -927,7 +927,7 @@ async function handleGetByLabel(
|
||||
browser: BrowserManager
|
||||
): Promise<Response> {
|
||||
const page = browser.getPage();
|
||||
const locator = page.getByLabel(command.label);
|
||||
const locator = page.getByLabel(command.label, { exact: command.exact });
|
||||
|
||||
switch (command.subaction) {
|
||||
case 'click':
|
||||
@@ -947,7 +947,7 @@ async function handleGetByPlaceholder(
|
||||
browser: BrowserManager
|
||||
): Promise<Response> {
|
||||
const page = browser.getPage();
|
||||
const locator = page.getByPlaceholder(command.placeholder);
|
||||
const locator = page.getByPlaceholder(command.placeholder, { exact: command.exact });
|
||||
|
||||
switch (command.subaction) {
|
||||
case 'click':
|
||||
|
||||
Reference in New Issue
Block a user