临时提交
This commit is contained in:
@@ -1,10 +1,13 @@
|
||||
import random
|
||||
import threading
|
||||
import time
|
||||
from enum import Enum
|
||||
import wda
|
||||
import os
|
||||
from Utils.AiUtils import AiUtils
|
||||
from Utils.ControlUtils import ControlUtils
|
||||
from Utils.LogManager import LogManager
|
||||
from Entity.Variables import anchorList, removeModelFromAnchorList
|
||||
|
||||
|
||||
# 脚本管理类
|
||||
@@ -28,10 +31,14 @@ class ScriptManager():
|
||||
def growAccount(self, udid, event):
|
||||
client = wda.USBClient(udid)
|
||||
session = client.session()
|
||||
session.appium_settings({"snapshotMaxDepth": 15})
|
||||
session.appium_settings({"snapshotMaxDepth": 0})
|
||||
|
||||
# 检测当前打开的是否是Tik Tok。如果不是就打开
|
||||
ControlUtils.openTikTok(session)
|
||||
# 先关闭Tik Tok
|
||||
ControlUtils.closeTikTok(session, udid)
|
||||
time.sleep(1)
|
||||
|
||||
# 重新打开Tik Tok
|
||||
ControlUtils.openTikTok(session, udid)
|
||||
time.sleep(3)
|
||||
|
||||
# 创建udid名称的目录
|
||||
@@ -93,6 +100,86 @@ class ScriptManager():
|
||||
print(f"发生异常:{e}")
|
||||
client.swipe_up()
|
||||
|
||||
|
||||
# 观看直播
|
||||
def viewLive(self):
|
||||
pass
|
||||
|
||||
# 关注打招呼
|
||||
def greetNewFollowers(self, udid, needReply, event):
|
||||
client = wda.USBClient(udid)
|
||||
session = client.session()
|
||||
session.appium_settings({"snapshotMaxDepth": 15})
|
||||
|
||||
# 先关闭Tik Tok
|
||||
ControlUtils.closeTikTok(session, udid)
|
||||
time.sleep(1)
|
||||
|
||||
# 重新打开Tik Tok
|
||||
ControlUtils.openTikTok(session, udid)
|
||||
time.sleep(3)
|
||||
|
||||
# 点击搜索按钮
|
||||
searchButton = ControlUtils.clickSearch(session)
|
||||
if searchButton is not None:
|
||||
searchButton.click()
|
||||
else:
|
||||
print("没找到搜索按钮")
|
||||
return
|
||||
|
||||
# 搜索框
|
||||
input = session.xpath('//XCUIElementTypeSearchField')
|
||||
|
||||
# 获取一个主播
|
||||
anchor = anchorList[0]
|
||||
aid = anchor.anchorId
|
||||
|
||||
# 如果找到了输入框,就点击并且输入内容
|
||||
if input.exists:
|
||||
input.click()
|
||||
time.sleep(1)
|
||||
input.set_text(aid + "\n")
|
||||
|
||||
# 切换UI查找深度
|
||||
session.appium_settings({"snapshotMaxDepth": 25})
|
||||
|
||||
# 点击进入主播首页
|
||||
session.xpath(
|
||||
'(//XCUIElementTypeCollectionView[@name="TTKSearchCollectionComponent"]'
|
||||
'//XCUIElementTypeCell'
|
||||
'//XCUIElementTypeButton[following-sibling::XCUIElementTypeButton[@name="关注" or @label="关注"]])[1]'
|
||||
).get(timeout=5).tap()
|
||||
|
||||
time.sleep(3)
|
||||
|
||||
# 向上划一点
|
||||
r = client.swipe_up()
|
||||
print(r)
|
||||
|
||||
# 分析页面节点
|
||||
# print(session.source())
|
||||
|
||||
# 观看主播视频
|
||||
def viewAnchorVideo():
|
||||
pass
|
||||
|
||||
viewAnchorVideo()
|
||||
else:
|
||||
pass
|
||||
# 功能待完善
|
||||
|
||||
|
||||
|
||||
# while not event.is_set() and len(anchorList) > 0:
|
||||
# anchor = anchorList[0]
|
||||
# aid = anchor.anchorId
|
||||
#
|
||||
# ControlUtils.clickSearch(session, udid)
|
||||
#
|
||||
# # 删除数据
|
||||
# removeModelFromAnchorList(anchor)
|
||||
# print(len(anchorList))
|
||||
|
||||
# manager = ScriptManager()
|
||||
# manager.growAccount("eca000fcb6f55d7ed9b4c524055214c26a7de7aa")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user