Skip to main content
Glama

pilot_select_option

Select dropdown options by value, label, or visible text in browser automation using element references or CSS selectors.

Instructions

Select a dropdown option by value, label, or visible text.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
refYesSelect element ref (@e3) or CSS selector
valueYesOption value, label, or text to select

Implementation Reference

  • The implementation of the `pilot_select_option` tool, which uses `BrowserManager` to resolve the target element and Playwright's `selectOption` method to perform the selection.
    server.tool(
      'pilot_select_option',
      'Select a dropdown option by value, label, or visible text.',
      {
        ref: z.string().describe('Select element ref (@e3) or CSS selector'),
        value: z.string().describe('Option value, label, or text to select'),
      },
      async ({ ref, value }) => {
        await bm.ensureBrowser();
        try {
          const resolved = await bm.resolveRef(ref);
          if ('locator' in resolved) {
            await resolved.locator.selectOption(value, { timeout: 5000 });
          } else {
            await bm.getPage().selectOption(resolved.selector, value, { timeout: 5000 });
          }
          bm.resetFailures();
          return { content: [{ type: 'text' as const, text: `Selected "${value}" in ${ref}` }] };
        } catch (err) {
          bm.incrementFailures();
          return { content: [{ type: 'text' as const, text: wrapError(err) }], isError: true };
        }
      }
    );

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/TacosyHorchata/Pilot'

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