Skip to main content
Glama

browser_element_is_displayed

Check if a web element is visible on the page using locator strategies like ID, CSS, or XPath to verify display status for testing and automation workflows.

Instructions

Checks if an element is displayed

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
byYesLocator strategy to find element
valueYesValue for the locator strategy
timeoutNoMaximum time to wait for element in milliseconds

Implementation Reference

  • Registers the 'browser_element_is_displayed' tool with the MCP server, including schema and inline handler that delegates to ElementService.
    server.tool(
      'browser_element_is_displayed',
      'Checks if an element is displayed',
      { ...locatorSchema },
      async ({ by, value, timeout = 15000 }) => {
        try {
          const driver = stateManager.getDriver();
          const elementService = new ElementService(driver);
          const isDisplayed = await elementService.isElementDisplayed({
            by,
            value,
            timeout,
          });
          return {
            content: [{ type: 'text', text: `Element is displayed: ${isDisplayed}` }],
          };
        } catch (e) {
          return {
            content: [
              {
                type: 'text',
                text: `Error checking element display status: ${(e as Error).message}`,
              },
            ],
          };
        }
      }
    );
  • Core handler logic for checking if the browser element is displayed using Selenium WebDriver.
    async isElementDisplayed(params: LocatorParams): Promise<boolean> {
      try {
        const element = await this.findElement(params);
        return element.isDisplayed();
      } catch {
        return false;
      }
    }
  • Zod schema defining the input parameters (by, value, timeout) for locating the element in the browser_element_is_displayed tool.
    export const locatorSchema = {
      by: z
        .enum(['id', 'css', 'xpath', 'name', 'tag', 'class', 'link', 'partialLink'])
        .describe('Locator strategy to find element'),
      value: z.string().describe('Value for the locator strategy'),
      timeout: z.number().optional().describe('Maximum time to wait for element in milliseconds'),
    };
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. While 'checks' implies a read-only operation, it doesn't specify whether this tool waits for the element to appear (hinted by the 'timeout' parameter), what happens if the element isn't found (e.g., returns false vs. throws error), or any performance considerations. For a tool with no annotation coverage, this leaves significant behavioral gaps.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence with zero waste—'Checks if an element is displayed' directly conveys the core purpose without unnecessary words. It's appropriately sized and front-loaded, making it easy for an agent to parse quickly.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's moderate complexity (checking element visibility with a timeout), no annotations, and no output schema, the description is minimally adequate but has clear gaps. It doesn't explain the return value (e.g., boolean true/false), error handling, or how it interacts with sibling tools, leaving the agent to rely on the schema and inference for full understanding.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema description coverage is 100%, with clear descriptions for all parameters ('by', 'value', 'timeout'), including an enum for 'by'. The description adds no additional parameter semantics beyond what's in the schema, so it meets the baseline of 3 where the schema does the heavy lifting without compensating for any gaps.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description 'Checks if an element is displayed' clearly states the tool's purpose with a specific verb ('checks') and resource ('element'), making it easy to understand. However, it doesn't explicitly differentiate from siblings like 'browser_element_is_enabled' or 'browser_element_is_selected', which have similar checking functions but for different element properties.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention when to choose this over other element-checking tools (e.g., 'browser_element_is_enabled') or when to use it in conjunction with tools like 'browser_wait_for_element'. Without any usage context or exclusions, the agent must infer this from the tool name alone.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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/pshivapr/selenium-mcp'

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