feat: MCP Browser v3.0 - 42 tools with stealth mode, multi-tab, PDF, cookies, storage, network logs, device emulation
This commit is contained in:
+4
-14
@@ -2,21 +2,11 @@ const browser = require('../browser');
|
||||
|
||||
module.exports = async ({ selector = 'a' }) => {
|
||||
await browser.start();
|
||||
const p = await browser.ensurePage();
|
||||
|
||||
const links = await p.evaluate((sel) => {
|
||||
const elements = Array.from(document.querySelectorAll(sel));
|
||||
|
||||
return elements.map(el => ({
|
||||
const links = await browser.evaluateJS((sel) => {
|
||||
return Array.from(document.querySelectorAll(sel)).map(el => ({
|
||||
text: (el.innerText || el.textContent || '').trim(),
|
||||
href: el.href || el.getAttribute('href') || ''
|
||||
})).filter(link => link.href && link.href !== '');
|
||||
})).filter(link => link.href);
|
||||
}, selector);
|
||||
|
||||
return {
|
||||
success: true,
|
||||
action: "get_links",
|
||||
count: links.length,
|
||||
links
|
||||
};
|
||||
return { success: true, action: 'get_links', count: links.length, links };
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user