Skip to main content
Glama

browser_scroll_to_coordinates

Navigate web pages by scrolling to exact pixel coordinates (X and Y positions) for precise browser automation and testing.

Instructions

Scroll to specific coordinates

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
xYesX coordinate
yYesY coordinate

Implementation Reference

  • Core implementation of scrolling to specific coordinates using Selenium WebDriver's executeScript to run window.scrollTo(x, y). This is the exact logic executed for the tool.
    async scrollToCoordinates(x: number, y: number): Promise<void> { await this.driver.executeScript(`window.scrollTo(${x}, ${y});`); }
  • Registers the 'browser_scroll_to_coordinates' MCP tool, defines input schema (x, y coordinates), and provides wrapper handler that creates ActionService and calls the core scroll method.
    server.tool( 'browser_scroll_to_coordinates', 'Scroll to specific coordinates', { x: z.number().describe('X coordinate'), y: z.number().describe('Y coordinate'), }, async ({ x, y }) => { try { const driver = stateManager.getDriver(); const actionService = new ActionService(driver); await actionService.scrollToCoordinates(x, y); return { content: [{ type: 'text', text: `Scrolled to coordinates (${x}, ${y})` }], }; } catch (e) { return { content: [ { type: 'text', text: `Error scrolling to coordinates: ${(e as Error).message}`, }, ], }; } } );
  • High-level registration entry point that calls registerActionTools, thereby including the browser_scroll_to_coordinates tool.
    export function registerAllTools(server: McpServer, stateManager: StateManager): void { registerBrowserTools(server, stateManager); registerElementTools(server, stateManager); registerActionTools(server, stateManager); registerCookieTools(server, stateManager); }
  • Zod schema for tool inputs: x and y as numbers.
    { x: z.number().describe('X coordinate'), y: z.number().describe('Y coordinate'), },

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/pshivapr/selenium-mcp'

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