diff --git a/CHANGELOG.md b/CHANGELOG.md index 4b1b829..6a2aecd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,14 @@ 本文件对应技能市场 **「更新日志」** Tab。 +## 1.1.9 + +- **RPA headed 模式改用系统 Edge(解决浏览器弹窗不可见)** + - **根因**:v1.1.8 headed 模式用 Playwright 内置 chromium,**在 Windows 桌面 session 下能创建浏览器对象但 GUI 窗口不可见**(子进程 bash session 与用户桌面 session 不同),导致 `--show-browser` 看似启动 headed 实际用户看不到弹窗、无法手工登录,180s 后 LOGIN_TIMEOUT + - **修复**:headed 模式改为 Playwright `channel="msedge"` 启动**系统 Microsoft Edge**(跟用户桌面 session 同源,能真正弹窗);系统 Edge 缺失时 fallback Playwright 内置 chromium + - 验证(2026-09-14):`collect-from-platform --show-browser --limit 1 --human-wait-timeout 240` → 系统 Edge 弹出窗口 → 用户手工登录 → RPA 24 秒内检测到 → 抓 3 行合同(钱实验/孙助理/王明远)→ 抓卡片 381 字 → 落库 `saved_contracts=1 / downloaded_materials=1` + - 测试:28/28 passed + ## 1.1.8 - **RPA 首次登录采集修复(用户反馈驱动)** diff --git a/SKILL.md b/SKILL.md index 568c5e2..ae4a5d9 100644 --- a/SKILL.md +++ b/SKILL.md @@ -1,7 +1,7 @@ --- name: 合同到期智能预警与续聘辅助 description: "每日凌晨扫描全校教职工合同电子台账,对距离到期日 90/60/30 天的合同分级预警,并自动生成《续聘准备任务书》和《本月合同到期人员清单》。" -version: 1.1.8 +version: 1.1.9 author: 深圳匠厂科技有限公司 metadata: openclaw: diff --git a/scripts/service/platform_collector.py b/scripts/service/platform_collector.py index 7384ff6..5565196 100644 --- a/scripts/service/platform_collector.py +++ b/scripts/service/platform_collector.py @@ -306,12 +306,38 @@ def collect_all( downloaded = 0 with sync_playwright() as p: - ctx = p.chromium.launch_persistent_context( - user_data_dir=str(profile_dir), - headless=headless, - accept_downloads=True, - viewport={"width": 1440, "height": 900}, - ) + # v1.1.9:headed 模式优先用系统 Edge(跟 Windows 桌面 session 同源, + # 能真正弹窗让你看到并手工登录);找不到则 fallback Playwright 内置 chromium + if not headless: + try: + ctx = p.chromium.launch_persistent_context( + user_data_dir=str(profile_dir), + headless=False, + accept_downloads=True, + channel="msedge", + viewport={"width": 1440, "height": 900}, + ) + logger.info( + "platform_collector: 使用系统 Edge(headed 弹窗)" + ) + except Exception as e: + logger.warning( + "platform_collector: 系统 Edge 启动失败(%s),fallback Playwright chromium", + e, + ) + ctx = p.chromium.launch_persistent_context( + user_data_dir=str(profile_dir), + headless=False, + accept_downloads=True, + viewport={"width": 1440, "height": 900}, + ) + else: + ctx = p.chromium.launch_persistent_context( + user_data_dir=str(profile_dir), + headless=True, + accept_downloads=True, + viewport={"width": 1440, "height": 900}, + ) try: page = ctx.new_page() # v1.1.6:覆盖 Playwright 默认操作超时(之前无 set_default_timeout,导致 diff --git a/scripts/util/constants.py b/scripts/util/constants.py index 10ec7bf..e2f90c2 100644 --- a/scripts/util/constants.py +++ b/scripts/util/constants.py @@ -6,7 +6,7 @@ """ SKILL_SLUG = "alert-contract-expiring-hr" -SKILL_VERSION = "1.1.8" +SKILL_VERSION = "1.1.9" LOG_LOGGER_NAME = "openclaw.skill.alert_contract_expiring_hr" PLATFORM_KIT_MIN_VERSION = "1.2.11"