Files
iOSAI/script/ScriptManager.py

47 lines
1.1 KiB
Python
Raw Normal View History

2025-08-01 13:43:51 +08:00
import cv2
import lxml
import wda
from lxml import etree
from script.AiTools import AiTools
# 脚本管理类
class ScriptManager():
def __init__(self):
super().__init__()
# 养号
@classmethod
def growAccount(self, udid):
client = wda.USBClient(udid)
session = client.session()
session.appium_settings({"snapshotMaxDepth": 0})
2025-08-01 22:10:53 +08:00
# deviceWidth = client.window_size().width
# deviceHeight = client.window_size().height
2025-08-01 13:43:51 +08:00
img = client.screenshot()
2025-08-01 22:10:53 +08:00
tempPath = "resources/bgv.jpg"
2025-08-01 13:43:51 +08:00
img.save(tempPath)
2025-08-01 22:10:53 +08:00
smallImage = AiTools.pathWithName("like")
bigImage = AiTools.pathWithName("bgv")
2025-08-01 13:43:51 +08:00
2025-08-01 22:10:53 +08:00
x, y = AiTools.find_image_in_image(bigImage, smallImage)
2025-08-01 13:43:51 +08:00
print(x, y)
2025-08-01 22:10:53 +08:00
# client.tap(x, y)
2025-08-01 13:43:51 +08:00
# xml = session.source()
# print(xml)
# root = etree.fromstring(xml.encode('utf-8'))
# try:
# msg = client.xpath('label="收件箱"')
# msg.click()
# print(msg)
# except Exception as e:
# print(e)