Files
MCP-Browser/tools/type.js
T

21 lines
436 B
JavaScript

const browser = require('../browser');
module.exports = async ({ selector, text }) => {
if (!selector || !text) {
throw new Error('Selector e text são obrigatórios');
}
await browser.start();
const p = await browser.ensurePage();
await p.waitForSelector(selector, { state: 'visible', timeout: 10000 });
await p.fill(selector, text);
return {
success: true,
action: "type",
selector,
text
};
};