ai 开始测试

This commit is contained in:
2025-08-27 21:58:55 +08:00
parent 741e52afd3
commit 699cb18b7d
14 changed files with 827 additions and 342 deletions

View File

@@ -200,7 +200,7 @@ class AiUtils(object):
homeButton = session.xpath("//*[@label='首页']")
try:
if homeButton.label == "首页":
print("找到了")
print("1.找到了")
return homeButton
else:
print("没找到")
@@ -243,7 +243,7 @@ class AiUtils(object):
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("找到了")
print("2.找到了")
return followButton
else:
print("没找到")
@@ -254,7 +254,7 @@ class AiUtils(object):
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("找到了")
print("3.找到了")
return msgButton
else:
print("没找到")
@@ -294,6 +294,16 @@ class AiUtils(object):
root = etree.fromstring(xml.encode("utf-8"))
items = []
# 判断是否是聊天页面
is_chat_page = False
if root.xpath('//XCUIElementTypeStaticText[contains(@traits, "Header")]'):
is_chat_page = True
elif root.xpath('//XCUIElementTypeCell//XCUIElementTypeOther[@name or @label]'):
is_chat_page = True
if not is_chat_page:
raise Exception("请先进入聊天页面")
# 屏幕宽度
app = root.xpath('/XCUIElementTypeApplication')
screen_w = cls.parse_float(app[0], 'width', 414.0) if app else 414.0