import json import os from selenium import webdriver from selenium.webdriver.chrome.options import Options options = Options() options.add_experimental_option("debuggerAddress", os.environ.get("WEHAGO_CHROME_DEBUGGER_ADDRESS", "127.0.0.1:9225")) driver = webdriver.Chrome(options=options) driver.set_script_timeout(10) script = r""" const ids = Array.from(document.querySelectorAll('.rg-body')).map((el) => ({ view: String(el.$_view || ''), text: (el.textContent || '').slice(0, 200), rect: (() => { const r = el.getBoundingClientRect(); return {left:r.left, top:r.top, width:r.width, height:r.height}; })() })); const summarize = (name, value) => { const out = {name, type: typeof value, text: String(value).slice(0, 300)}; if (value && typeof value === 'object') { let keys = []; try { keys = Object.getOwnPropertyNames(value).concat(Object.keys(value)); } catch(e) {} out.keys = Array.from(new Set(keys)).slice(0, 250); out.samples = out.keys.slice(0, 80).map((key) => { try { const v = value[key]; return {key, type: typeof v, text: String(v).slice(0, 160)}; } catch (e) { return {key, error: String(e)}; } }); } return out; }; const out = {ids, globals: []}; const names = ['Grids', 'RealGridJS', 'RealGrid', 'realgrid']; for (const name of names) out.globals.push(summarize(name, window[name])); for (const key of Object.keys(window)) { if (/grid|real|view|provider/i.test(key)) { try { out.globals.push(summarize('window.' + key, window[key])); } catch(e) {} } if (out.globals.length > 80) break; } return out; """ print(json.dumps(driver.execute_script(script), ensure_ascii=False, indent=2)[:100000]) driver.quit()