scraping_browser_get_html
Extract HTML content from web pages for data collection and analysis using the Bright Data Web MCP server's browser automation capabilities.
Instructions
Get the HTML content of the current page. Avoid using the full_page option unless it is important to see things like script tags since this can be large
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| full_page | No | Whether to get the full page HTML including head and script tags Avoid this if you only need the extra HTML, since it can be quite large |
Implementation Reference
- browser_tools.js:229-241 (handler)The execute function that implements the core logic of the scraping_browser_get_html tool, fetching HTML content from the browser page either partially (body only) or fully.execute: async({full_page = false})=>{ const page = await (await require_browser()).get_page(); try { if (!full_page) return await page.$eval('body', body=>body.innerHTML); const html = await page.content(); if (!full_page && html) return html.split('<body>')[1].split('</body>')[0]; return html; } catch(e){ throw new UserError(`Error getting HTML content: ${e}`); } },
- browser_tools.js:222-228 (schema)Zod schema defining the input parameters for the scraping_browser_get_html tool.parameters: z.object({ full_page: z.boolean().optional().describe([ 'Whether to get the full page HTML including head and script tags', 'Avoid this if you only need the extra HTML, since it can be ' +'quite large', ].join('\n')), }),
- browser_tools.js:307-320 (registration)Registration of the scraping_browser_get_html tool in the exported tools array, conditional on the presence of API_TOKEN environment variable.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];