scraping_browser_links
Extract all links, text, and selectors from web pages to validate click targets and gather structured data for web scraping and browser automation.
Instructions
Get all links on the current page, text and selectors It's strongly recommended that you call the links tool to check that your click target is valid
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- browser_tools.js:134-150 (handler)The core handler function that executes the tool logic: retrieves all anchor ('a') elements on the current page, extracts their text, href, and outerHTML as selector, and returns them as JSON.execute: async()=>{ const page = await (await require_browser()).get_page(); try { const links = await page.$$eval('a', elements=>{ return elements.map(el=>{ return { text: el.innerText, href: el.href, selector: el.outerHTML, }; }); }); return JSON.stringify(links, null, 2); } catch(e){ throw new UserError(`Error getting links: ${e}`); } },
- browser_tools.js:133-134 (schema)Zod input schema defining no parameters are required for this tool.parameters: z.object({}), execute: async()=>{
- browser_tools.js:307-320 (registration)The tool object 'scraping_browser_links' is registered by being included in the exported 'tools' array (line 311 specifically), conditional on API_TOKEN being set.export const tools = process.env.API_TOKEN ? [ scraping_browser_navigate, scraping_browser_go_back, scraping_browser_go_forward, scraping_browser_links, scraping_browser_click, scraping_browser_type, scraping_browser_wait_for, scraping_browser_screenshot, scraping_browser_get_text, scraping_browser_get_html, scraping_browser_scroll, scraping_browser_scroll_to, ] : [scraping_browser_activation_instructions];