11号晚临时提交
This commit is contained in:
@@ -5,6 +5,7 @@ import cv2
|
||||
import numpy as np
|
||||
import wda
|
||||
from Utils.LogManager import LogManager
|
||||
import xml.etree.ElementTree as ET
|
||||
|
||||
# 工具类
|
||||
class AiUtils(object):
|
||||
@@ -209,10 +210,10 @@ class AiUtils(object):
|
||||
|
||||
# 查找关闭按钮
|
||||
@classmethod
|
||||
def findCloseButton(cls,udid="eca000fcb6f55d7ed9b4c524055214c26a7de7aa"):
|
||||
def findLiveCloseButton(cls,udid="eca000fcb6f55d7ed9b4c524055214c26a7de7aa"):
|
||||
client = wda.USBClient(udid)
|
||||
session = client.session()
|
||||
session.appium_settings({"snapshotMaxDepth": 0})
|
||||
session.appium_settings({"snapshotMaxDepth": 10})
|
||||
r = session.xpath("//XCUIElementTypeButton[@name='关闭屏幕']")
|
||||
try:
|
||||
if r.label == "关闭屏幕":
|
||||
@@ -223,4 +224,22 @@ class AiUtils(object):
|
||||
print(e)
|
||||
return None
|
||||
|
||||
# AiUtils.screenshot()
|
||||
# 获取直播间窗口数量
|
||||
@classmethod
|
||||
def count_add_by_xml(cls, session):
|
||||
xml = session.source()
|
||||
root = ET.fromstring(xml)
|
||||
return sum(
|
||||
1 for e in root.iter()
|
||||
if e.get('type') in ('XCUIElementTypeButton', 'XCUIElementTypeImage')
|
||||
and (e.get('name') == '添加' or e.get('label') == '添加')
|
||||
and (e.get('visible') in (None, 'true'))
|
||||
)
|
||||
|
||||
# 获取当前屏幕上的节点
|
||||
@classmethod
|
||||
def getCurrentScreenSource(cls):
|
||||
client = wda.USBClient("eca000fcb6f55d7ed9b4c524055214c26a7de7aa")
|
||||
print(client.source())
|
||||
|
||||
# AiUtils.getCurrentScreenSource()
|
||||
Reference in New Issue
Block a user