@cutleryapp/agent 1.0.10 → 1.0.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/mcp-executor.js +5 -4
- package/package.json +1 -1
package/dist/mcp-executor.js
CHANGED
|
@@ -223,11 +223,12 @@ async function tryClick(page, nameRe, label) {
|
|
|
223
223
|
}
|
|
224
224
|
async function tryClickScoped(page, nameRe, target, scope) {
|
|
225
225
|
const FAST = 3000;
|
|
226
|
-
//
|
|
226
|
+
// Strip trailing generic nouns that won't appear verbatim on the page
|
|
227
|
+
const cleanScope = scope.replace(/\s+(?:product|item|section|card|row|container|element|button|link|area|panel|block)$/i, '').trim();
|
|
227
228
|
const strategies = [
|
|
228
|
-
() => page.locator(`:has-text("${
|
|
229
|
-
() => page.locator(`:has-text("${
|
|
230
|
-
() => page.locator(`:has-text("${
|
|
229
|
+
() => page.locator(`:has-text("${cleanScope}")`).last().getByRole('button', { name: nameRe }).first().click({ timeout: FAST }),
|
|
230
|
+
() => page.locator(`:has-text("${cleanScope}")`).last().getByRole('link', { name: nameRe }).first().click({ timeout: FAST }),
|
|
231
|
+
() => page.locator(`:has-text("${cleanScope}")`).last().getByText(nameRe).first().click({ timeout: FAST }),
|
|
231
232
|
// Fallback: ignore scope and click anywhere
|
|
232
233
|
() => page.getByRole('button', { name: nameRe }).first().click({ timeout: FAST }),
|
|
233
234
|
() => page.getByText(nameRe).first().click({ timeout: FAST }),
|