scroll-element
Simulate user interaction by scrolling to a specified element on a webpage using its selector, enabling automated navigation and access to content in AdsPower LocalAPI MCP Server workflows.
Instructions
Scroll the element
Input 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 |
Input Schema (JSON Schema)
{
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": false,
"properties": {
"selector": {
"description": "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",
"type": "string"
}
},
"required": [
"selector"
],
"type": "object"
}
Implementation Reference
- src/handlers/automation.ts:112-122 (handler)The core handler function that executes the scroll-element tool. It waits for the element by selector, then uses evaluate to call scrollIntoView on it.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 for input validation of scroll-element tool, requiring 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 with the MCP server, providing name, description, input schema, and wrapped handler reference.server.tool('scroll-element', 'Scroll the element', schemas.scrollElementSchema.shape, wrapHandler(automationHandlers.scrollElement));