fix locator issues (#14)

* fix locator issues

* address feedback
This commit is contained in:
Chris Tate
2026-01-12 00:29:53 -06:00
committed by GitHub
parent 403a7e5d56
commit a0802b1863
3 changed files with 202 additions and 25 deletions
+11 -3
View File
@@ -95,12 +95,20 @@ export class BrowserManager {
const page = this.getPage();
// Parse the selector and create locator
// Build locator with exact: true to avoid substring matches
let locator: Locator;
if (refData.name) {
return page.getByRole(refData.role as any, { name: refData.name });
locator = page.getByRole(refData.role as any, { name: refData.name, exact: true });
} else {
return page.getByRole(refData.role as any);
locator = page.getByRole(refData.role as any);
}
// If an nth index is stored (for disambiguation), use it
if (refData.nth !== undefined) {
locator = locator.nth(refData.nth);
}
return locator;
}
/**