Skip to main content
Glama

page_waitTimeout

Pauses execution for a specified duration in milliseconds during WeChat Mini Program automation, allowing synchronization with page loading or element rendering.

Instructions

等待指定的毫秒数。

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
connectionNo
millisecondsYes

Implementation Reference

  • Creates the 'page_waitTimeout' tool, including its handler (execute function) that parses arguments, acquires the page via manager, and calls page.waitFor(milliseconds) to wait the specified time.
    function createWaitForTimeoutTool(manager: WeappAutomatorManager): AnyTool { return { name: "page_waitTimeout", description: "等待指定的毫秒数。", parameters: waitForTimeoutParameters, execute: async (rawArgs, context: ToolContext) => { const args = waitForTimeoutParameters.parse(rawArgs ?? {}); return manager.withPage<ContentResult>( context.log, { overrides: args.connection }, async (page) => { await page.waitFor(args.milliseconds); return toTextResult(`已等待 ${args.milliseconds}ms。`); } ); }, }; }
  • Zod schema defining the input parameters for the 'page_waitTimeout' tool: milliseconds as a non-negative integer.
    const waitForTimeoutParameters = connectionContainerSchema.extend({ milliseconds: z.coerce.number().int().nonnegative(), });
  • Registers the 'page_waitTimeout' tool (via createWaitForTimeoutTool(manager)) in the array of page tools returned by createPageTools.
    export function createPageTools(manager: WeappAutomatorManager): AnyTool[] { return [ createGetElementTool(manager), createWaitForElementTool(manager), createWaitForTimeoutTool(manager), createGetPageDataTool(manager), createSetPageDataTool(manager), createCallPageMethodTool(manager), ];

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/yfmeii/weapp-dev-mcp'

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