browser_scroll_to_top
Scroll to the top of the page during web automation. Use this tool to return to the page's starting position for consistent testing or navigation.
Instructions
Scroll to the top of the page
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/tools/actionTools.ts:282-300 (handler)The inline handler and registration for the 'browser_scroll_to_top' tool. It retrieves the WebDriver from StateManager, instantiates ActionService, and calls scrollToTop().server.tool('browser_scroll_to_top', 'Scroll to the top of the page', {}, async () => { try { const driver = stateManager.getDriver(); const actionService = new ActionService(driver); await actionService.scrollToTop(); return { content: [{ type: 'text', text: `Scrolled to top of the page` }], }; } catch (e) { return { content: [ { type: 'text', text: `Error scrolling to top: ${(e as Error).message}`, }, ], }; } });
- src/services/actionService.ts:75-77 (helper)The supporting method in ActionService that executes the JavaScript 'window.scrollTo(0, 0);' to scroll to the top of the page using the WebDriver.async scrollToTop(): Promise<void> { await this.driver.executeScript('window.scrollTo(0, 0);'); }