MCPcopy Create free account
hub / github.com/InverseUI/InverseUI-Recorder / findElement

Function findElement

util/dom_utils.js:15–29  ·  view source on GitHub ↗
(xpath)

Source from the content-addressed store, hash-verified

13 * Find element by XPath
14 */
15export function findElement(xpath) {
16 try {
17 const result = document.evaluate(
18 xpath,
19 document,
20 null,
21 XPathResult.FIRST_ORDERED_NODE_TYPE,
22 null
23 );
24 return result.singleNodeValue;
25 } catch (e) {
26 console.error('XPath evaluation error:', e);
27 return null;
28 }
29}
30
31/**
32 * Check if element is visible to user

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected