import json

try:
    with open(r'C:\Users\Variet-Worker\.gemini\antigravity\bridge\deep-inspect-result.json', 'r', encoding='utf-8', errors='ignore') as f:
        data = json.load(f)

    print(f"Total Nodes: {len(data.get('nodes', []))}")
    for node in data.get('nodes', []):
        label = node.get('label', 'unknown')
        iframes = node.get('iframes', [])
        webviews = node.get('webviews', [])
        buttons = node.get('buttons', [])
        print(f"[Node] {label}")
        print(f"  URL: {node.get('url', '')[:50]}")
        print(f"  Total Elements: {node.get('totalElements', 0)}")
        print(f"  Buttons count: {len(buttons)}")
        print(f"  Iframes count: {len(iframes)}")
        print(f"  Webviews count: {len(webviews)}")
        if iframes:
            for iframe in iframes:
                print(f"    - iframe[{iframe.get('index')}]: accessible={iframe.get('accessible')} src={iframe.get('src', '')[:50]}")
        if webviews:
            for w in webviews:
                print(f"    - webview[{w.get('index')}]: src={w.get('src', '')[:50]}")

except Exception as e:
    print(f'Error reading JSON: {e}')
