新增支持逻辑分辨率为2.0的机型

This commit is contained in:
2025-11-13 19:31:09 +08:00
parent b9e2d86857
commit f799a6df77
7 changed files with 148 additions and 68 deletions

View File

@@ -151,16 +151,31 @@ class ControlUtils(object):
@classmethod
def clickLike(cls, session: Client, udid):
try:
scale = session.scale
x, y = AiUtils.findImageInScreen("add", udid)
print(x, y)
if x > -1:
LogManager.method_info("点赞了", "关注打招呼", udid)
session.click(x // scale, y // scale + 50)
return True
from script.ScriptManager import ScriptManager
width, height, scale = ScriptManager.get_screen_info(udid)
if scale == 3.0:
x, y = AiUtils.findImageInScreen("add", udid)
if x > -1:
LogManager.method_info(f"点赞了,点赞的坐标是:{x // scale, y // scale + 50}", "关注打招呼", udid)
session.click(int(x // scale), int(y // scale + 50))
return True
else:
LogManager.method_info("没有找到目标", "关注打招呼", udid)
return False
else:
LogManager.method_info("没有找到目标", "关注打招呼", udid)
return False
x, y = AiUtils.findImageInScreen("like1", udid)
if x > -1:
LogManager.method_info(f"点赞了,点赞的坐标是:{x // scale, y // scale}", "关注打招呼", udid)
session.click(int(x // scale), int(y // scale))
return True
else:
LogManager.method_info("没有找到目标", "关注打招呼", udid)
return False
except Exception as e:
LogManager.method_info(f"点赞出现异常,异常的原因:{e}", "关注打招呼", udid)
raise False
@@ -191,8 +206,6 @@ class ControlUtils(object):
# 获取主播详情页的第一个视频
@classmethod
def clickFirstVideoFromDetailPage(cls, session: Client):
# videoCell = session.xpath(
# '//Window/Other[1]/Other[1]/Other[1]/Other[1]/Other[1]/Other[1]/Other[1]/Other[1]/Other[1]/Other[2]/Other[1]/ScrollView[1]/Other[1]/CollectionView[1]/Cell[2]')
videoCell = session.xpath(
'(//XCUIElementTypeCollectionView//XCUIElementTypeCell[.//XCUIElementTypeImage[@name="profile_video"]])[1]')