feat: CDP bridge batch support - cookies/tabs/cdp mixed commands, lazy attach, $N chain refs, file upload & screenshot verified

This commit is contained in:
Liang Jiaqing
2026-03-04 13:06:21 +08:00
parent 3f8407a853
commit 313f8a28f0
6 changed files with 63 additions and 13 deletions

View File

@@ -860,9 +860,11 @@ def get_html(driver, cutlist=False, maxchars=28000, instruction="", extra_js="")
if len(ss) > maxchars: ss = ss[:maxchars] + ' ... [TRUNCATED]'
return ss
def execute_js_rich(script, driver):
try: last_html = get_html(driver, cutlist=False, extra_js=temp_monitor_js)
except: last_html = None
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)
except: pass
result = None; error_msg = None; reloaded = False; newTabs = []
before_sids = set(driver.get_session_dict().keys())
try:
@@ -889,6 +891,7 @@ def execute_js_rich(script, driver):
rr['environment']['newTabs'] = newTabs
rr['suggestion'] = "页面已刷新,以上新标签页在执行期间连接。"
if error_msg: rr['error'] = error_msg
if no_monitor: return rr
if not reloaded:
try: rr['transients'] = get_temp_texts(driver)
except: rr['transients'] = []