韵达音频授权提示弹窗清理(含重试重载后)+ 服务模式读取 debug 配置
- site_yunda:抽 dismiss_audio_prompt 助手(点「确定」);yunda_reset 重载主页后调用(解决重试重载后弹窗复现) - runtime:_dismiss_initial_popups 韵达分支改用 dismiss_audio_prompt;launch_and_prepare 自己读 config.yaml 的 debug 段(服务模式也生效,之前仅 main_router 传参) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -45,10 +45,25 @@ def with_retry(site_name, label, flow, reset, max_attempts=3):
|
||||
HOME_URL = "https://ky-sso.yunda56.com"
|
||||
|
||||
|
||||
def dismiss_audio_prompt(page):
|
||||
"""关闭韵达「音频设备未授权」提示弹窗(点确定);未出现则跳过。
|
||||
|
||||
该弹窗在主页(含重试重载后)会重复出现,故需在每次主页加载后清理。"""
|
||||
try:
|
||||
modal = page.locator(".ivu-modal-confirm", has_text="音频设备未授权").first
|
||||
modal.wait_for(state="visible", timeout=2000)
|
||||
modal.locator(".ivu-modal-confirm-footer button.ivu-btn-primary").click()
|
||||
print(" ✅ 【韵达】已关闭音频设备授权提示。")
|
||||
return True
|
||||
except Exception:
|
||||
return False
|
||||
|
||||
|
||||
def yunda_reset(page):
|
||||
"""异常兜底:重置韵达到初始态(跳首页 URL,丢弃当前页面状态,登录态保留)。"""
|
||||
page.goto(HOME_URL)
|
||||
page.wait_for_timeout(1500)
|
||||
dismiss_audio_prompt(page) # 主页重载后音频授权提示会复现,清理之
|
||||
|
||||
|
||||
def _remove_if_exists(path):
|
||||
|
||||
Reference in New Issue
Block a user