Skip to main content
Glama

scraping_browser_scroll_to

Scroll to specific elements on web pages using CSS selectors for precise data extraction and navigation during web scraping and browser automation.

Instructions

Scroll to a specific element on the page

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
selectorYesCSS selector for the element to scroll to

Implementation Reference

  • Full implementation of the 'scraping_browser_scroll_to' tool, including name, description, input schema (parameters), and the execute handler function that uses Puppeteer-like page.evaluate to scroll the element into view.
    let scraping_browser_scroll_to = { name: 'scraping_browser_scroll_to', description: 'Scroll to a specific element on the page', parameters: z.object({ selector: z.string().describe('CSS selector for the element to scroll to'), }), execute: async({selector})=>{ const page = await (await require_browser()).get_page(); try { await page.evaluate(sel=>{ const element = document.querySelector(sel); if (element) element.scrollIntoView({ behavior: 'smooth', block: 'center' }); else throw new Error(`Element with selector "${sel}" not found`); }, selector); return `Successfully scrolled to element: ${selector}`; } catch(e){ throw new UserError(`Error scrolling to element ${selector}: ${e}`); } }, };
  • Registration of the 'scraping_browser_scroll_to' tool in the exported 'tools' array, which is conditionally included based 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];

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/dsouza-anush/brightdata-mcp-heroku'

If you have feedback or need assistance with the MCP directory API, please join our Discord server