Skip to main content
Glama
nfodor

Chromium ARM64 Browser

by nfodor

get_selected_element

Retrieve details of the currently selected element in the Chromium ARM64 Browser, enabling precise web automation and testing on ARM64 devices like Raspberry Pi.

Instructions

Get information about the currently selected element

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The main handler function for the 'get_selected_element' tool. It uses CDP Runtime.evaluate to get details of the currently active element (document.activeElement), including tagName, id, className, textContent snippet, value, and a simple selector. Returns formatted JSON or 'No element currently selected'.
    async getSelectedElement() { await this.ensureChromium(); const result = await this.sendCDPCommand('Runtime.evaluate', { expression: ` const activeElement = document.activeElement; if (activeElement && activeElement !== document.body) { JSON.stringify({ tagName: activeElement.tagName, id: activeElement.id, className: activeElement.className, textContent: activeElement.textContent?.substring(0, 100), value: activeElement.value || null, selector: activeElement.id ? \`#\${activeElement.id}\` : activeElement.className ? \`.\${activeElement.className.split(' ')[0]}\` : activeElement.tagName.toLowerCase() }); } else { null; } `, returnByValue: true }); const selectedElement = result.result?.value ? JSON.parse(result.result.value) : null; return { content: [{ type: 'text', text: selectedElement ? JSON.stringify(selectedElement, null, 2) : 'No element currently selected' }], }; }
  • Input schema definition for the 'get_selected_element' tool: no required parameters (empty properties).
    name: 'get_selected_element', description: 'Get information about the currently selected element', inputSchema: { type: 'object', properties: {}, }, },
  • index.js:377-378 (registration)
    Registration/dispatch in the CallToolRequestSchema switch statement, mapping the tool name to the getSelectedElement() handler method.
    case 'get_selected_element': return await this.getSelectedElement();

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/nfodor/mcp-chromium-arm64'

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