def __init__(self): self.GameLoaded_info = {} self.GameLoaded_info["loadtime"] = None self.GameLoaded_info["ErrorTxt"] = [] COM_utilities.clock() # 插入计时器 self.mysleep(10) FindObject.__init__(self)
def editCoverIcon(self): """选择封面""" if self.find_object("CoverIcon", description="是否无封面", waitTime=5): self.findClick_childobject( self.poco("LuaUIIntroduceEdit").child("Cover"), description="选择封面", waitTime=2, sleeptime=2) POCO = self.poco("Options").child("Button(Clone)")[0] self.findClick_childobject(POCO, description="从我的图库中", sleeptime=2) self.mysleep(2) if self.android_tryfind( "com.android.packageinstaller:id/permission_allow_button", description="检查开启图库权限", waitTime=3): self.android_findClick( "com.android.packageinstaller:id/permission_allow_button", "com.android.packageinstaller:id/permission_allow_button", description="检查开启图库权限", waitTime=1) ADBdevice = MyData.EnvData_dir["ADBdevice"] if ADBdevice in MyData.mobileconf_dir["Upload_Image"]: Upload_ImageData = MyData.mobileconf_dir["Upload_Image"][ ADBdevice] for val in range(0, len(Upload_ImageData)): clickName = Upload_ImageData[val] if type(clickName) == list: touch(clickName) print("点击", clickName) elif type(clickName) == int: sleep(clickName) else: self.findClick_try(clickName, clickName, description=clickName, waitTime=5, sleeptime=3, pocotype="Androidpoco") elif "127" in MyData.EnvData_dir["ADBdevice"]: print("模拟器类型") self.mumu() else: print("mobileconf未找到上传图片对应配置") COM_utilities.clock() while self.find_try("LoadingPanel", description="加载图标"): print("图片loading中") sleep(1) mytime = float(COM_utilities.clock("stop")) if mytime > 50: print("图片选择失败,请检查权限问题") log(Exception("图片选择失败,请检查权限问题"), snapshot=True) raise Exception("图片选择失败,请检查权限问题") else: print("已存在封面,跳过封面选择")
def gameloading(self, login=1): # 游戏是否加载完成判断 while self.poco("Slider").wait(1).exists(): self.Popo_Errorinfo() self.Popup_login(login=1) if float(COM_utilities.clock("stop")) > 360: print("游戏加载失败。。。") log(Exception("游戏加载失败。。。"), snapshot=True) raise Exception if self.GameLoaded_info["loadtime"] is None: self.GameLoaded_info["loadtime"] = float( COM_utilities.clock("stop")) - 2 mylog.info("完成游戏加载,加载时间为{0}秒".format(self.GameLoaded_info["loadtime"])) return True
def Popup_login(self, login=1): """游戏进入界面弹框处理,0无弹框,1,有弹框跳过,2,有弹框点击登录""" login = int(login) if login == 0: return True if self.find_try("LoginGuide_LoginCtrl", description="游戏登陆弹框", waitTime=5): # 登陆弹框 self.GameLoaded_info["loadtime"] = float( COM_utilities.clock("stop")) - 2 if login == 1: try: # self.findClick_object("GuideViewBackBtn", "GuideViewBackBtn", description="点击返回箭头", waitTime=5,sleeptime=2) self.notchfit__Click_try("GuideViewBackBtn", "GuideViewBackBtn", description="点击返回箭头", waitTime=5, sleeptime=2) finally: self.findClick_object("StartGame", "StartGame", description="点击Play Now按钮", waitTime=2) self.GameLoaded_info["游戏登陆弹框"] = "跳过登陆" # elif login == 2: # SignIn1 = SignIn() # SignIn1.loginGuide_login_process() # sleep(3) # self.GameLoaded_info["游戏登陆弹框"] = "登陆" # self.GameLoaded_info["登陆状态"] = SignIn1.SignIn_info["用户登陆状态"] # self.PageTurn.Bottom_click(0) return self.GameLoaded_info
def discoverPopup(self): # 积分弹框 """大厅弹框检查""" self.Popuplist = [] poplist = MyData.popup_dir[0] havePopup = True self.UIAlterPoP() COM_utilities.clock() # 插入计时器 while havePopup: print("进入弹框判断") mytime = float(COM_utilities.clock("stop")) if mytime > 60: log(Exception("弹框处理超时...."), snapshot=True) raise Exception if self.poco("PopupPanel").children(): print("进入PopupPanel弹框判断") child = self.poco("PopupPanel").child(nameMatches="^UI.*", visible=True) for list in child: listname = list.get_name() print("listname:", listname) for k in poplist: if listname == k["args"][0]: if listname == "UIGiftPopup": if self.find_try("UIGiftPopup", "推送礼包", 0.2, tryTime=1): self.findClick_try("GiftShake", "GiftBag3", "礼物", 0.2, tryTime=1, sleeptime=5) self.findClick_try("UIBagItemReward", "BtnStore", "会员卡", 0.2, tryTime=1, sleeptime=1) self.findClick_try("UIBagItemReward", "BtnRead", "背包道具推送", 0.2, tryTime=1, sleeptime=1) else: self.findClick_try(k["args"][0], k["args"][1], description=k["func_name"], waitTime=1, tryTime=1, sleeptime=2) elif self.poco("PopUpPanel").children(): print("进入PopUpPanel弹框判断") try: child1 = self.poco("PopUpPanel").child(nameMatches="^UI.*", visible=True) for list in child1: listname = list.get_name() print("listname:", listname) for k in poplist: if listname == k["args"][0]: if listname == "UIGiftPopup": if self.find_try("UIGiftPopup", "推送礼包", 0.2, tryTime=1): self.findClick_try("GiftShake", "GiftBag3", "礼物", 0.2, tryTime=1, sleeptime=5) self.findClick_try("UIBagItemReward", "BtnStore", "会员卡", 0.2, tryTime=1, sleeptime=1) self.findClick_try("UIBagItemReward", "BtnRead", "背包道具推送", 0.2, tryTime=1, sleeptime=1) else: self.findClick_try( k["args"][0], k["args"][1], description=k["func_name"], waitTime=1, tryTime=1, sleeptime=0.5) except: print("PopUpPanel非点击弹框") else: print("判断当前无弹框") havePopup = False self.discoverPopup_info["弹框列表:"] = FindObject.Popuplist return True