临时提交

This commit is contained in:
zw
2025-08-12 22:03:08 +08:00
parent 1ce16cff46
commit cd61c2138a
4 changed files with 131 additions and 112 deletions

View File

@@ -53,15 +53,19 @@ class ControlUtils(object):
@classmethod
def clickBack(cls, session: Client):
try:
x, y = AiUtils.findImageInScreen("back")
if x > 0:
r = session.swipe_right()
if r.status == 0:
return True
else:
return False
back = session.xpath("//*[@label='返回']")
if back.exists:
back.click()
return True
elif session.xpath("//*[@name='nav_bar_start_back']").exists:
back = session.xpath("//*[@name='nav_bar_start_back']")
back.click()
return True
elif session.xpath("//Window[1]/Other[1]/Other[1]/Other[1]/Other[1]/Other[1]/Other[1]/Other[1]/Other[1]/Other[1]/Other[1]/Other[1]/Other[1]/Other[1]").exists:
back = session.xpath("//Window[1]/Other[1]/Other[1]/Other[1]/Other[1]/Other[1]/Other[1]/Other[1]/Other[1]/Other[1]/Other[1]/Other[1]/Other[1]/Other[1]")
back.click()
return True
else:
print("本页面无法返回")
return False
except Exception as e:
print(e)
@@ -80,23 +84,6 @@ class ControlUtils(object):
else:
print("没有找到目标")
return False
# 点击评论
# @classmethod
# def clickComment(cls, session: Client):
# scale = session.scale
# x, y = AiUtils.findImageInScreen("add")
# print(x,y)
# if x > -1:
# print("找到目标了")
# r = session.click(x // scale, y // scale + 120)
# if r.status == 0:
# return True
# else:
# return False
# else:
# print("没有找到目标")
# return False
# 点击搜索
@classmethod
@@ -110,6 +97,16 @@ class ControlUtils(object):
print(e)
return False
# 点击收件箱按钮
@classmethod
def clickMsgBox(cls, session: Client):
box = session.xpath("//XCUIElementTypeButton[name='a11y_vo_inbox']")
if box.exists:
box.click()
return True
else:
return False
# 获取主播详情页的第一个视频
@classmethod
def clickFirstVideoFromDetailPage(cls, session: Client):
@@ -121,28 +118,5 @@ class ControlUtils(object):
else:
return False
# 获取关注按钮
@classmethod
def clickFollowButton(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("找到了")
followButton.click()
return True
else:
print("没找到")
return False
# 查找发消息按钮
@classmethod
def clickSendMesageButton(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(msgButton.name)
msgButton.click()
return True
else:
print("没找到")
return False