Skip to main content
Glama
eva-wanxin-git

Windows Automation MCP Server

browser_click

Automate browser interactions by clicking elements using CSS selectors to streamline web testing and repetitive tasks.

Instructions

点击元素

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
selectorYesCSS 选择器
sessionIdNo会话 ID(可选)

Implementation Reference

  • The handler function that executes the browser_click tool logic: retrieves the page for the session, waits for the CSS selector, clicks the element, and returns success/error status.
    async click(selector, sessionId = 'default') {
      try {
        const page = this.pages.get(sessionId);
        if (!page) {
          return { success: false, error: '浏览器未启动' };
        }
    
        await page.waitForSelector(selector, { timeout: 5000 });
        await page.click(selector);
    
        return { success: true, selector, message: '点击成功' };
      } catch (error) {
        return { success: false, error: error.message };
      }
    }
  • Tool definition including name, description, and input schema for browser_click, defining required 'selector' parameter.
    {
      name: 'browser_click',
      description: '点击元素',
      inputSchema: {
        type: 'object',
        properties: {
          selector: { type: 'string', description: 'CSS 选择器' },
          sessionId: { type: 'string', description: '会话 ID(可选)' },
        },
        required: ['selector'],
      },
    },
  • Registration of the browser_click handler in the executeTool switch statement, mapping tool calls to the click method.
    case 'browser_click':
      return await this.click(args.selector, args.sessionId);

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/eva-wanxin-git/windows-automation-mcp'

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