scroll-element
Scroll to specific elements on web pages using CSS selectors. This tool helps automate browser interactions by navigating to elements that require scrolling to access.
Instructions
Scroll the element
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| selector | Yes | The selector of the element to scroll, find from the page source code, Simulates a user navigating page by scrolling, usually finding element in the bottom of the page |
Implementation Reference
- src/handlers/automation.ts:112-122 (handler)The main handler function for the 'scroll-element' tool. It waits for the selector, then uses page.evaluate to scroll the element into view smoothly.async scrollElement({ selector }: ScrollElementParams) { browser.checkConnected(); await browser.pageInstance!.waitForSelector(selector); await browser.pageInstance!.evaluate((selector) => { const element = document.querySelector(selector); if (element) { element.scrollIntoView({ behavior: 'smooth' }); } }, selector); return `Scrolled element with selector: ${selector} successfully`; },
- src/types/schemas.ts:200-202 (schema)Zod schema defining the input parameters for the scroll-element tool: requires a 'selector' string.scrollElementSchema: z.object({ selector: z.string().describe('The selector of the element to scroll, find from the page source code, Simulates a user navigating page by scrolling, usually finding element in the bottom of the page') }).strict(),
- src/utils/toolRegister.ts:80-81 (registration)Registers the 'scroll-element' tool on the MCP server, providing name, description, input schema, and wrapped handler.server.tool('scroll-element', 'Scroll the element', schemas.scrollElementSchema.shape, wrapHandler(automationHandlers.scrollElement));