skopix 2.0.17 → 2.0.18
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/cli/commands/agent.js +25 -0
- package/package.json +1 -1
package/cli/commands/agent.js
CHANGED
|
@@ -384,7 +384,32 @@ export async function agentCommand(options) {
|
|
|
384
384
|
}
|
|
385
385
|
if (!clicked) { for (const s of selectors) { if (clicked) break; try { await page.locator(s).first().scrollIntoViewIfNeeded({ timeout: 3000 }).catch(() => {}); await page.locator(s).first().click({ timeout: 5000 }); clicked = true; } catch {} } }
|
|
386
386
|
if (!clicked) { for (const s of selectors) { if (clicked) break; try { await page.locator(s).first().click({ force: true, timeout: 5000 }); clicked = true; } catch {} } }
|
|
387
|
+
if (!clicked) {
|
|
388
|
+
// Last resort — JS dispatch for framework-managed elements
|
|
389
|
+
for (const s of selectors) {
|
|
390
|
+
if (clicked) break;
|
|
391
|
+
try {
|
|
392
|
+
await page.locator(s).first().evaluate(el => {
|
|
393
|
+
el.dispatchEvent(new MouseEvent('mousedown', { bubbles: true, cancelable: true }));
|
|
394
|
+
el.dispatchEvent(new MouseEvent('mouseup', { bubbles: true, cancelable: true }));
|
|
395
|
+
el.dispatchEvent(new MouseEvent('click', { bubbles: true, cancelable: true }));
|
|
396
|
+
});
|
|
397
|
+
clicked = true;
|
|
398
|
+
} catch {}
|
|
399
|
+
}
|
|
400
|
+
}
|
|
387
401
|
if (!clicked) throw new Error('Could not click: ' + selectors.join(', '));
|
|
402
|
+
|
|
403
|
+
// Special handling for Bootstrap dropdowns — wait for menu to appear
|
|
404
|
+
try {
|
|
405
|
+
const el = await page.locator(selectors[0]).first();
|
|
406
|
+
const isDropdown = await el.evaluate(e => e.hasAttribute('data-toggle') && e.getAttribute('data-toggle') === 'dropdown').catch(() => false);
|
|
407
|
+
if (isDropdown) {
|
|
408
|
+
await page.waitForSelector('.dropdown-menu:visible, .dropdown.open .dropdown-menu', { timeout: 3000 }).catch(() => {});
|
|
409
|
+
await page.waitForTimeout(300);
|
|
410
|
+
}
|
|
411
|
+
} catch {}
|
|
412
|
+
|
|
388
413
|
await page.waitForTimeout(400);
|
|
389
414
|
|
|
390
415
|
} else if (step.action === 'type') {
|
package/package.json
CHANGED