修复掉设备问题

This commit is contained in:
2025-10-27 16:25:47 +08:00
parent 3c3bde7df9
commit c902e6f4d3
8 changed files with 175 additions and 120 deletions

View File

@@ -1111,23 +1111,18 @@ class ScriptManager():
" or @value='Inbox' or @label='Inbox' or @name='Inbox']"
)
print("11111111111111")
# 查找所有收件箱节点
inbox_nodes = session.xpath(xpath_query).find_elements()
print("222222222222222")
if len(inbox_nodes) < 2:
LogManager.method_error(f"当前页面不再收件箱页面,重启", "检测消息", udid)
raise Exception("当前页面不再收件箱页面,重启")
print("33333333333333")
m = re.search(r'(\d+)', el.label) # 抓到的第一个数字串
count = int(m.group(1)) if m else 0
print("444444444444444444")
if not count:
LogManager.method_info(f"当前收件箱的总数量{count}", "检测消息", udid)
break
# print("5555555555555555555555")
# 新粉丝
xp_new_fan_badge = (
@@ -1170,7 +1165,6 @@ class ScriptManager():
"[@value and translate(@value,'0123456789','')='']"
"/ancestor::XCUIElementTypeCell[1]"
)
print("6666666666666666")
try:
# 如果 2 秒内找不到,会抛异常
@@ -1184,7 +1178,6 @@ class ScriptManager():
print("当前屏幕没有找到 用户消息 未读徽标数字", udid)
user_text = None
info_count += 1
print("777777777777777777777")
if user_text:
@@ -1218,11 +1211,11 @@ class ScriptManager():
last_in = item['text']
if last_out is None and item['dir'] == 'out':
last_out = item['text']
if last_in or last_out: # 任一条拿到就提前停
if last_in and last_out: # 任一条拿到就提前停
break
# 2. 只有两条都空才重试
if not last_in and not last_out:
if not last_in or not last_out:
attempt += 1
if attempt == 3:
break # 三次用完,放弃