# -*- coding: utf-8 -*- """查 head 原文 + 浏览器 styleSheets 加载情况""" import io, sys, time from pathlib import Path sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8') P = Path(r'e:\code\crm-backend-matt\.scratch\a7-parity\pages\a7-3-1_线索规则') h = (P / 'a7-3-1_线索规则.html').read_text(encoding='utf-8', errors='replace') head = h[:h.find('') + 7] print('=== raw ({ sheets: [...document.styleSheets].map(s => { let n = -1; try { n = s.cssRules.length } catch(e) { n = 'ERR:' + e.message } return {href: (s.href||'inline').split('/').pop(), rules: n}; }), u3: (() => { const el = document.getElementById('u3'); if (!el) return 'no u3'; const cs = getComputedStyle(el); return {pos: cs.position, left: cs.left, top: cs.top, w: cs.width, h: cs.height}; })(), u3img: (() => { const el = document.getElementById('u3_img'); if (!el) return 'none'; const cs = getComputedStyle(el); return {w: cs.width, h: cs.height, display: cs.display, src: el.src.slice(-30)}; })(), })""") for k, v in info.items(): print(k, ':', v) browser.close()