chore: auto release commit (2026-09-15 01:23:04)
Some checks failed
技能自动化发布 / release (push) Failing after 4s

This commit is contained in:
2026-09-15 01:23:04 +08:00
parent 0157fde0f1
commit 430274dbf9
5 changed files with 67 additions and 43 deletions

View File

@@ -263,14 +263,17 @@ def _try_auto_sign_in(page, wait_input_sec: int = 2) -> bool:
def _wait_for_login_inputs_filled(page, wait_sec: int = HUMAN_WAIT_TIMEOUT) -> bool:
"""v1.1.21:等用户输入完账号密码。
v1.1.24:**不再自动点 Sign in**——按用户要求:「等待用户输入信息后跳转页面」,
按钮交给用户自己点。脚本只负责等 URL 跳离登录页。
"""v1.1.21:等用户输入完账号密码,然后自动点登录按钮。
- 每 HUMAN_POLL_INTERVAL 秒检查 #jc-user / #jc-pass 是否有值(仅做状态日志)
- URL 已离开登录页 → return True(用户可能自己点登录完成)
- input 有值 → 提示「请点登录按钮」(**脚本不抢按钮**)
- 超时未跳离登录页 → return False
v1.1.26:按用户最新要求改回**自动点登录**行为——
「到了 /industries/campus/smartcampus/login 整个页面,有账号和密码可用直接点登录跳转」,
不再等用户自己点。
优先级(任一 selector 命中即视为有 input):
- user: `#jc-user` / `input[type='tel']` / `input[autocomplete='username']`
- pass: `#jc-pass` / `input[type='password']` / `input[autocomplete='current-password']`
按钮文本优先级:`Sign in` / `登录` / `Login` / `signin` / `submit`。
"""
deadline = time.monotonic() + wait_sec
last_prompt_at = time.monotonic()
@@ -286,21 +289,21 @@ def _wait_for_login_inputs_filled(page, wait_sec: int = HUMAN_WAIT_TIMEOUT) -> b
)
return True
# 探测 input 是否就绪 + 是否已有值(仅做日志,不主动 click)
# 探测 input(多 selector 优先级)
user_val, pass_val = "", ""
user_loc, pass_loc = None, None
for sel in ("#jc-user", "input[type='tel']", "input[autocomplete='username']"):
loc = page.locator(sel).first
if loc.count() > 0:
user_loc = loc
user_val = (loc.input_value() or "").strip()
break
else:
user_val = ""
for sel in ("#jc-pass", "input[type='password']", "input[autocomplete='current-password']"):
loc = page.locator(sel).first
if loc.count() > 0:
pass_loc = loc
pass_val = (loc.input_value() or "").strip()
break
else:
pass_val = ""
now = time.monotonic()
if now - last_state_log >= HUMAN_PROMPT_INTERVAL:
@@ -310,11 +313,34 @@ def _wait_for_login_inputs_filled(page, wait_sec: int = HUMAN_WAIT_TIMEOUT) -> b
bool(user_val), bool(pass_val), cur_url,
)
# 提醒用户:input 有值时明确告诉用户「点登录按钮」
# input 都有值 → 自动点登录按钮(v1.1.26 关键:用户最新要求自动点)
if user_val and pass_val:
btn = None
btn_text_used = ""
for txt in ("Sign in", "登录", "Login", "signin"):
loc = page.locator(f"button:has-text('{txt}')").first
if loc.count() > 0:
btn = loc
btn_text_used = txt
break
if btn is None:
btn = page.locator("button[type='submit']").first
btn_text_used = "submit"
if btn is not None and btn.count() > 0:
logger.info(
"platform_collector: ✅ 账号密码已填好(user=%r),自动点 %s 按钮",
user_val, btn_text_used,
)
btn.click()
return True
logger.warning("platform_collector: input 有值但找不到登录按钮")
# 提醒用户
if now - last_prompt_at >= HUMAN_PROMPT_INTERVAL:
last_prompt_at = now
remaining = int(deadline - now)
if user_val and pass_val:
# 上面 click 应该已经 return,不会到这里
print(
f"[登录] ✅ 账号密码已填好(user={user_val[:3]}***),"
f"请点「登录」按钮,剩余 {remaining}s..."

View File

@@ -6,7 +6,7 @@
"""
SKILL_SLUG = "alert-contract-expiring-hr"
SKILL_VERSION = "1.1.25"
SKILL_VERSION = "1.1.26"
LOG_LOGGER_NAME = "openclaw.skill.alert_contract_expiring_hr"
PLATFORM_KIT_MIN_VERSION = "1.2.11"