临时提交
This commit is contained in:
@@ -6,6 +6,7 @@ import numpy as np
|
||||
import wda
|
||||
from Utils.LogManager import LogManager
|
||||
import xml.etree.ElementTree as ET
|
||||
from wda import Client
|
||||
|
||||
# 工具类
|
||||
class AiUtils(object):
|
||||
@@ -236,10 +237,46 @@ class AiUtils(object):
|
||||
and (e.get('visible') in (None, 'true'))
|
||||
)
|
||||
|
||||
# 获取关注按钮
|
||||
@classmethod
|
||||
def getFollowButton(cls, session: Client):
|
||||
followButton = session.xpath("//Window[1]/Other[1]/Other[1]/Other[1]/Other[1]/Other[1]/Other[1]/Other[1]/Other[1]/Other[1]/Other[2]/Other[2]/Other[1]/Other[1]/Other[3]/Other[1]/Other[1]/Button[1]")
|
||||
if followButton.exists:
|
||||
print("找到了")
|
||||
return followButton
|
||||
else:
|
||||
print("没找到")
|
||||
return None
|
||||
|
||||
# 查找发消息按钮
|
||||
@classmethod
|
||||
def getSendMesageButton(cls, session: Client):
|
||||
msgButton = session.xpath("//Window[1]/Other[1]/Other[1]/Other[1]/Other[1]/Other[1]/Other[1]/Other[1]/Other[1]/Other[1]/Other[2]/Other[2]/Other[1]/Other[1]/Other[3]/Other[1]/Other[1]")
|
||||
if msgButton.exists:
|
||||
print("找到了")
|
||||
return msgButton
|
||||
else:
|
||||
print("没找到")
|
||||
return None
|
||||
|
||||
# 获取当前屏幕上的节点
|
||||
@classmethod
|
||||
def getCurrentScreenSource(cls):
|
||||
client = wda.USBClient("eca000fcb6f55d7ed9b4c524055214c26a7de7aa")
|
||||
print(client.source())
|
||||
|
||||
# AiUtils.getCurrentScreenSource()
|
||||
|
||||
# 查找app主页上的收件箱按钮
|
||||
@classmethod
|
||||
def getMsgBoxButton(cls, session: Client):
|
||||
box = session.xpath("//XCUIElementTypeButton[name='a11y_vo_inbox']")
|
||||
if box.exists:
|
||||
return box
|
||||
else:
|
||||
return None
|
||||
|
||||
# 获取收件箱中的未读消息数
|
||||
@classmethod
|
||||
def getUnReadMsgCount(cls, session: Client):
|
||||
btn = cls.getMsgBoxButton(session)
|
||||
return cls.findNumber(btn.label)
|
||||
Reference in New Issue
Block a user