Skip to main content
Glama

pilot_page_css

Retrieve computed CSS property values for web elements using element references or CSS selectors to inspect styling in browser automation.

Instructions

Get computed CSS property value for an element.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
refYesElement ref or CSS selector
propertyYesCSS property name (e.g. color, font-size)

Implementation Reference

  • The implementation of the pilot_page_css tool handler, which uses Playwright's locator to evaluate and retrieve the computed CSS property of a specified element.
    server.tool(
      'pilot_page_css',
      'Get computed CSS property value for an element.',
      {
        ref: z.string().describe('Element ref or CSS selector'),
        property: z.string().describe('CSS property name (e.g. color, font-size)'),
      },
      async ({ ref, property }) => {
        await bm.ensureBrowser();
        try {
          const page = bm.getPage();
          const resolved = await bm.resolveRef(ref);
          const locator = 'locator' in resolved ? resolved.locator : page.locator(resolved.selector);
          const value = await locator.evaluate(
            (el, prop) => getComputedStyle(el).getPropertyValue(prop),
            property
          );
          return { content: [{ type: 'text' as const, text: value }] };
        } catch (err) {
          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