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

Method getElementProperties

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

Source from the content-addressed store, hash-verified

533
534 // Get comprehensive element properties
535 getElementProperties(xpath) {
536 const element = this.findElement(xpath);
537 if (!element) {
538 return { success: false, error: 'Element not found', xpath: xpath };
539 }
540
541 const rect = element.getBoundingClientRect();
542 const computedStyle = window.getComputedStyle(element);
543
544 return {
545 success: true,
546 xpath: xpath,
547 properties: {
548 // Basic properties
549 tagName: element.tagName,
550 id: element.id,
551 className: element.className,
552 classList: Array.from(element.classList),
553
554 // Content
555 textContent: element.textContent.trim(),
556 innerHTML: element.innerHTML,
557 value: element.value || null,
558
559 // Attributes
560 attributes: Array.from(element.attributes).reduce((acc, attr) => {
561 acc[attr.name] = attr.value;
562 return acc;
563 }, {}),
564
565 // State
566 disabled: element.disabled || false,
567 readonly: element.readOnly || false,
568 required: element.required || false,
569 checked: element.checked || false,
570 selected: element.selected || false,
571
572 // Position and dimensions
573 position: {
574 top: rect.top,
575 left: rect.left,
576 bottom: rect.bottom,
577 right: rect.right,
578 width: rect.width,
579 height: rect.height
580 },
581
582 // Visibility
583 visible: this.isElementVisible(element),
584 display: computedStyle.display,
585 visibility: computedStyle.visibility,
586 opacity: computedStyle.opacity,
587
588 // Form validation (if applicable)
589 validity: element.validity || null,
590 validationMessage: element.validationMessage || null,
591
592 // Parent and children info

Callers 1

initMethod · 0.95

Calls 2

findElementMethod · 0.95
isElementVisibleMethod · 0.95

Tested by

no test coverage detected