feat: MCP Browser v3.1.1 - 56+ tools, visual overlays, fixes
- Added 9 new tools: visual overlay, highlight, toast, drag-drop, etc. - Fixed evaluateJS to support function arguments - Fixed hover for non-visible elements - Fixed storage operations with try/catch - Added 10 new wait tools: clickable, element visible, text - Fixed tool name mapping in server.js for MCP protocol - Updated README with 60+ tools documentation - Version bump to 3.1.1
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
const browser = require('../browser');
|
||||
|
||||
module.exports = async ({ sourceSelector, targetSelector }) => {
|
||||
if (!sourceSelector || !targetSelector) {
|
||||
throw new Error('sourceSelector e targetSelector são obrigatórios');
|
||||
}
|
||||
await browser.start();
|
||||
|
||||
const result = await browser.evaluateJS(`
|
||||
(function() {
|
||||
const source = document.querySelector('${sourceSelector}');
|
||||
const target = document.querySelector('${targetSelector}');
|
||||
if (!source || !target) return { success: false, error: 'Element not found' };
|
||||
|
||||
const sourceRect = source.getBoundingClientRect();
|
||||
const targetRect = target.getBoundingClientRect();
|
||||
|
||||
source.dispatchEvent(new DragEvent('dragstart', { bubbles: true }));
|
||||
target.dispatchEvent(new DragEvent('dragover', { bubbles: true }));
|
||||
target.dispatchEvent(new DragEvent('drop', { bubbles: true }));
|
||||
source.dispatchEvent(new DragEvent('dragend', { bubbles: true }));
|
||||
|
||||
return { success: true, sourceRect, targetRect };
|
||||
})()
|
||||
`);
|
||||
|
||||
return { success: true, action: 'drag_and_drop', ...result };
|
||||
};
|
||||
Reference in New Issue
Block a user