fix: zIndex auto coverage bug + monitor maxchars unlimit + autofill CDP sop update

This commit is contained in:
Liang Jiaqing
2026-03-07 10:10:26 +08:00
parent fd9f172588
commit 7ab47af8e8
2 changed files with 10 additions and 7 deletions

View File

@@ -69,10 +69,13 @@ document.body.appendChild(el); // 响应写回el.textContent
## autofill获取
检测web_scan输出input带`data-autofilled="true"`value显示为受保护提示(非真实值Chrome安全保护需点击释放)
- ⭐首选CDP batch一次完成tabs获tabId→mousePressed+mouseReleased点击**任一**输入框→全部autofill字段值释放→JS读`.value`
- ⚠点击一个autofill字段会释放页面上所有autofill字段的值无需逐个点击
-必须mousePressed+mouseReleased配对才算完整点击
- batch示例`{cmd:'batch',commands:[{cmd:'tabs'},{cmd:'cdp',tabId:'$0.0.id',method:'Input.dispatchMouseEvent',params:{type:'mousePressed',x:X,y:Y,button:'left',clickCount:1}},{cmd:'cdp',tabId:'$0.0.id',method:'Input.dispatchMouseEvent',params:{type:'mouseReleased',x:X,y:Y,button:'left',clickCount:1}}]}`
- ⭐首选CDP单次点击JS取任一autofill输入框坐标→CDP `Input.dispatchMouseEvent` mousePressed一次即可释放→JS读`.value`
- ⚠点击一个autofill字段会释放页面上**所有**autofill字段的值无需逐个点击
-只需mousePressed,不需要mouseReleased配对
- ⚠tabId当前注入页无需指定(默认sender.tab.id)跨tab才需显式tabId(整数)
- 示例(当前页)`{cmd:'cdp',method:'Input.dispatchMouseEvent',params:{type:'mousePressed',x:X,y:Y,button:'left',clickCount:1}}`
- 示例(跨tab):先`{cmd:'tabs'}`获取tabId(整数),再`{cmd:'cdp',tabId:N,method:'Input.dispatchMouseEvent',params:{...}}`
- ⚠batch的`$N.path`引用会将整数tabId转为字符串导致类型错误跨tab时建议分两次命令而非batch
- 备选PostMessage物理点击(仅Windows/需前台)枚举Chrome窗口标题匹配→rect*dpr→WM_LBUTTONDOWN/UP到Chrome_RenderWidgetHostHWND子窗口
-多RenderWidgetHostHWND共存必须按父窗口标题匹配再取子窗口

View File

@@ -200,7 +200,7 @@ function analyzeNode(node, pPathType='main') {
((minDimensionRatio > 0.2 && rect.width/window.innerWidth < 0.98) || minDimensionRatio > 0.95)) {
top.node.dataset.mark = 'K:mainInteractive';
sorted.slice(1).forEach(e => {
if (e.zIndex < sorted[0].zIndex) {
if ((parseInt(e.zIndex)||0) <= (parseInt(sorted[0].zIndex)||0)) {
e.node.dataset.mark = 'R:covered';
} else {
e.node.dataset.mark = 'K:noncovered';
@@ -877,7 +877,7 @@ def get_html(driver, cutlist=False, maxchars=38000, instruction="", extra_js="")
def execute_js_rich(script, driver, no_monitor=False):
last_html = None
if not no_monitor:
try: last_html = get_html(driver, cutlist=False, extra_js=temp_monitor_js)
try: last_html = get_html(driver, cutlist=False, extra_js=temp_monitor_js, maxchars=9999999)
except: pass
result = None; error_msg = None; reloaded = False; newTabs = []
before_sids = set(driver.get_session_dict().keys())
@@ -911,7 +911,7 @@ def execute_js_rich(script, driver, no_monitor=False):
except: rr['transients'] = []
if not reloaded and len(newTabs) == 0:
try:
current_html = get_html(driver, cutlist=False)
current_html = get_html(driver, cutlist=False, maxchars=9999999)
if last_html is None: raise Exception("no baseline")
diff_data = find_changed_elements(last_html, current_html)
change_count = diff_data.get('changed', 0)