import uiautomator2 as u2
import time
import adbutils
import multiprocessing
class HandleKaoyanbang(object):
def __init__(self, serial="127.0.0.1:62025"):
self.d = u2.connect_usb(serial=serial)
self.size = self.get_windowsize()
def get_windowsize(self):
"""获取手机屏幕的大小"""
return self.d.window_size()
def close_app(self):
# 停止考研帮app
self.d.app_stop("com.tencent.mm")
def enter_kja(self):
def ClickTryCatch(self, x, y, sleeptime):
def SetTextTryCatch(self, text, sleeptime):
def xiaochengxuGet(self):
def handle_kaoyanbang_app(self):
# 获取所有设备的序列号
def get_devices():
# 获取到当前操作系统中所接通的移动设备的序列号
return [d.serial for d in adbutils.adb.device_list()]
# 操控设备函数
def handle_device(serial):
k = HandleKaoyanbang(serial)
k.handle_kaoyanbang_app()
def main():
# 多进程启动u2滑动移动设备
for i in range(len(get_devices())):
serial = get_devices()[int(i)]
handle_device(serial)
#p = multiprocessing.Process(target=handle_device, args=(serial,))
#启动进程
#p.start()
if __name__ == __main__:
main()
暂时没有评论,来抢沙发吧~