Files
iOSAI/script/ScriptManager.py

42 lines
1.1 KiB
Python
Raw Normal View History

2025-08-05 15:41:20 +08:00
2025-08-01 13:43:51 +08:00
import wda
2025-08-05 15:41:20 +08:00
from Utils.AiUtils import AiUtils
2025-08-01 13:43:51 +08:00
# 脚本管理类
class ScriptManager():
2025-08-05 15:41:20 +08:00
# 单利对象
_instance = None # 类变量,用于存储单例实例
def __new__(cls):
# 如果实例不存在,则创建一个新实例
if cls._instance is None:
cls._instance = super(ScriptManager, cls).__new__(cls)
# 返回已存在的实例
return cls._instance
2025-08-01 13:43:51 +08:00
def __init__(self):
super().__init__()
2025-08-05 15:41:20 +08:00
# 脚本开关
self.running = False
self.initialized = True # 标记已初始化
2025-08-01 13:43:51 +08:00
# 养号
def growAccount(self, udid):
client = wda.USBClient(udid)
session = client.session()
2025-08-05 15:41:20 +08:00
session.appium_settings({"snapshotMaxDepth": 15})
numberLabel = session.xpath("//*[@name='a11y_vo_inbox']")
if numberLabel:
content = numberLabel.label
number = AiUtils.findNumber(content)
print(number)
else:
print("没找到")
manager = ScriptManager()
manager.growAccount("eca000fcb6f55d7ed9b4c524055214c26a7de7aa")
2025-08-01 13:43:51 +08:00