browser_scroll_to_top
Scroll to the top of the current web page to access navigation menus, refresh content, or return to page headers during automated browser testing.
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)MCP tool handler for browser_scroll_to_top, which instantiates ActionService and invokes its scrollToTop method, handling success and error responses.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)Core implementation of scrolling to the top of the page using Selenium WebDriver's executeScript to run 'window.scrollTo(0, 0)'.async scrollToTop(): Promise<void> { await this.driver.executeScript('window.scrollTo(0, 0);'); }
- src/tools/index.ts:11-11 (registration)Registration of action tools (including browser_scroll_to_top) via call to registerActionTools in the central tools registration function.registerActionTools(server, stateManager);