Files
MCP-Browser/tools/waitForSelector.js

10 lines
398 B
JavaScript

const browser = require('../browser');
module.exports = async ({ selector, timeout = 15000, state = 'attached' }) => {
if (!selector) throw new Error('Selector é obrigatório');
await browser.start();
const p = await browser.ensurePage();
const el = await p.waitForSelector(selector, { timeout, state });
return { success: true, action: 'wait_for_selector', selector, found: !!el };
};