def test_bossrush(self): """ bossrush -- bossrush界面判断 """ try: print("开始测试bossrush模块") self.assertEqual("本次挑战增益", bossrush.bossrush(start, devices)) except simplerpc.RpcTimeoutError: for i in range(initial.RpcTimeoutime()): # rpc超时问题重置次数 try: common.printred( "————————————————————————————————————Rpc重连失败,脚本重新启动————————————————————————————————————" ) initial.startgame(devices) self.assertEqual("本次挑战增益", bossrush.bossrush(start, devices)) break except simplerpc.RpcTimeoutError: common.printred( "————————————————————————————————————Rpc重连失败,脚本重新启动————————————————————————————————————" ) initial.startgame(devices) self.assertEqual("本次挑战增益", bossrush.bossrush(start, devices)) finally: common.get_screen_shot(start, time.time(), devices, "bossrush-冒烟测试")
def chat(start, devices): poco = common.deviceconnect(devices) poco("Back").click() # 点击聊天功能 sleep(1) chatlist = [1, 2, 3, 4, 10, 14] freeze_poco = poco.freeze() # TODO:定义冻结poco for tab in chatlist: tab1 = "tab" + str(tab) if freeze_poco("ChatNewDlg_ani").offspring(tab1).offspring("Bg").child( "name").exists(): common.printgreen("检查点 " + freeze_poco("ChatNewDlg_ani").offspring( tab1).offspring("Bg").child("name").get_text() + " 聊天选项 显示正确") poco("ChatNewDlg_ani").offspring(tab1).offspring("Bg").child( "name").click() if poco("chattext").exists(): poco("textinput").wait().set_text("聊五毛钱的天。。。") poco("sendchat").click() # 点击发送 if poco("addBtn").exists(): poco("addBtn").click() # 表情 sleep(1) item1 = "item" + str(random.randint(0, 23)) poco(item1).child("template").click() poco("sendchat").click() # 点击发送 sleep(2) else: common.printgreen("当前聊天选项没有输入选项") else: common.printred(f"检查点 聊天选项 发{tab1} 不存在,检查一下.一个大选项,大概率是因为没有加工会造成") common.get_screen_shot(start, time.time(), devices, "聊天选项控件缺失") return poco("ChatNewDlg_ani").offspring("tab4").offspring( "Selected").child("name").get_text()
def BtnBuild(start, poco, devices): # 建造 common.printgreen("进入建造界面") poco("NewGuildHall(Clone)").offspring("NewGuildInterior").offspring("item1").child("GO").click() freeze_poco = poco.freeze() # TODO:定义冻结poco if freeze_poco(text="公会建设").exists(): if freeze_poco(text="公会建设").exists() and \ freeze_poco("title3").exists() and \ freeze_poco("title1").exists() and \ freeze_poco("title2").exists() and \ freeze_poco(texture="public_Flag").exists() and \ freeze_poco("num").exists() and \ freeze_poco("Go2").exists() and \ freeze_poco("GuildGrowthBuildDlg(Clone)").offspring("Go2").child("BtnEnter").exists(): for item in range(len(freeze_poco("WrapContent").child()) - 8): item1 = "item" + str(item) if freeze_poco("GuildGrowthBuildDlg(Clone)").offspring(item1).exists(): poco("GuildGrowthBuildDlg(Clone)").offspring("Go2").child("Help").click() # 点击帮助介绍 if poco("Title").exists(): poco("Btn").click() # 关闭帮助 else: common.printred("帮助界面没有打开,请检查。。。") common.get_screen_shot(start, time.time(), devices, "捐赠今日排行界面元素缺失") poco("GuildGrowthBuildDlg(Clone)").offspring("Go2").child("BtnEnter").click() # 点击前往捐献 freeze_poco = poco.freeze() # TODO:定义冻结poco for item in range(len(freeze_poco("List").child())): item1 = "item" + str(item) if freeze_poco(item1).exists() and \ freeze_poco(item1).child("Do").exists() and \ freeze_poco("box").exists(): freeze_poco(item1).child("Do").click() # 点击缴纳 else: common.printred("捐赠今日排行界面元素缺失,请检查。。。") common.get_screen_shot(start, time.time(), devices, "捐赠今日排行界面元素缺失") poco("Close").click() close(poco)
def BtnRed(start, poco, devices): # 红包 freeze_poco = poco.freeze() # TODO:定义dongjiepoco if freeze_poco("Title").exists() and \ freeze_poco("circle1").exists() and \ freeze_poco("circle2").exists() and \ freeze_poco("circle3").exists() and \ freeze_poco("circle4").exists() and \ freeze_poco("Frame").exists() and \ freeze_poco("Buff").exists() and \ freeze_poco("Send").exists() and \ freeze_poco("Fiexd").exists() and \ freeze_poco("History").exists(): poco("Fiexd").click() # 点击红包池 freeze_poco = poco.freeze() # TODO:定义dongjiepoco if freeze_poco(texture="l_tip_00").exists() and \ freeze_poco("T3").exists() and \ freeze_poco("T2").exists() and \ freeze_poco("T1").exists() and \ freeze_poco("ailin").exists(): poco(texture="l_close_00").click() poco("History").click() # 点击历史红包 if poco("Help").exists(): poco("Close").click() # 点击返回 close(poco) else: common.printred("红包池界面元素缺失,请检查。。。") common.get_screen_shot(start, time.time(), devices, "红包池界面元素缺失") poco(texture="l_close_00").click() else: common.printred("工会红包界面元素缺失,请检查。。。") common.get_screen_shot(start, time.time(), devices, "工会红包界面元素缺失")
def bossrush(start, devices): poco = common.deviceconnect(devices) if poco("Duck").exists(): poco("Duck").click() sleep(2) poco("XSys_Activity").click() # 点击日常按钮 else: common.printgreen("主界面缺少日常按钮,请检查...") common.get_screen_shot(start, time.time(), devices, "主界面缺少日常按钮") pos = poco("DailyActivityDlg(Clone)").offspring( "XActivityHandler").offspring("Item927").offspring( "Background") # 无限幻境参加按钮 if pos.exists(): butpos(devices, butpos=pos, pos1=0.4, pos2=0.79, high=565, low=511, lows=240) # 调用butpos方法 pos.click() # 点击无限幻境参加按钮 else: common.printgreen("日常界面没有无限幻境选项,请检查...") common.get_screen_shot(start, time.time(), devices, "日常界面没有无限幻境选项") if poco("Title").exists(): common.printgreen("进入无限幻境界面,开始检测界面控件元素")
def title(start,devices): poco = common.deviceconnect(devices) if poco("SysAItem").get_position()[0] > 1: poco(texture="halln_4").click() sleep(1) poco("SysAItem").click() # 点击角色按钮 if poco("Title").exists(): common.printgreen("进入角色界面") if poco("XSys_Design_Designation").exists(): poco("XSys_Design_Designation").click() # 点击称号 if poco(text="日常称号").exists(): common.printgreen("进入称号界面,开始检测称号。。。") for i in range(1, 7): for Label in poco("ItemNewDlg(Clone)").offspring(str(i)).child("ChildList").offspring("Label"): Label.click() freeze_poco = poco.freeze() # TODO:定义冻结poco for ii in range(len(freeze_poco("WrapContent").child())): title = freeze_poco("ItemNewDlg(Clone)").offspring(f"item{ii}").offspring("Animation") if title.exists(): # 判断称号存在 pass else: if "fff" in title: print(freeze_poco("ItemNewDlg(Clone)").offspring(f"item{ii}").offspring( "Animation").get_text() + "称号显示错误") else: print("图片称号显示错误") common.get_screen_shot(start,time.time(), devices, "没有进入角色界面") poco("ItemNewDlg(Clone)").offspring(str(i)).child("Bg").click() common.printgreen("称号检测完毕。。。没有发现异常") else: common.printred("没有进入角色界面,请检查") common.get_screen_shot(start,time.time(), devices, "没有进入角色界面") return poco(text="[fff7b4]钓鱼大师").get_text() # [fff7b4]钓鱼大师
def BtnGz(start, poco, devices): # 工资 common.printgreen("进入工资界面") freeze_poco = poco.freeze() # TODO:定义冻结poco if freeze_poco("T").exists() and \ freeze_poco("Scoret").exists() and \ freeze_poco("Label").exists() and \ freeze_poco("GuildSalaryDlg(Clone)").offspring("frame").offspring("Up")\ .offspring("Background").exists() and \ freeze_poco("GuildSalaryDlg(Clone)").offspring("frame").child("Left")\ .child("Left").offspring("Background").exists() and \ freeze_poco("GuildSalaryDlg(Clone)").offspring("frame").offspring("Bottom")\ .offspring("Background").exists() and \ freeze_poco("GuildSalaryDlg(Clone)").offspring("frame").child("Left")\ .child("Right").offspring("Background").exists() and \ freeze_poco("GuildSalaryDlg(Clone)").offspring("frame").offspring("item0").exists() and \ freeze_poco("GuildSalaryDlg(Clone)").offspring("frame").offspring("item1").exists() and \ freeze_poco("p5").exists(): poco("GuildSalaryDlg(Clone)").offspring("frame").child("Left").child("Left").child("Go").click() # 点击提升 # 如果没有点击出现,就再点击一次 if not poco("2").exists(): common.printgreen("因为这边总是报错,所以截图检查一下") common.get_screen_shot(start, time.time(), devices, "因为这边总是报错,所以截图检查一下") poco("GuildSalaryDlg(Clone)").offspring("frame").child("Left").child("Left").child("Go").click() # 点击提升 freeze_poco = poco.freeze() # TODO:定义冻结poco if freeze_poco("2").exists() and \ freeze_poco("0").exists() and \ freeze_poco("3").exists() and \ freeze_poco("1").exists(): common.printgreen("提升界面检查完毕") poco("Close").click() else: common.printred("提升子界面缺少元素,请检查。。。") common.get_screen_shot(start, time.time(), devices, "提升子界面缺少元素") poco("Close").click() close(poco)
def mail(start, devices): poco = common.deviceconnect(devices) if poco("Back").exists(): poco("Back").click() # 点击聊天功能 sleep(1) # 点击世界频道按钮 poco("tab1").click() if poco("Mail").exists(): # 点击邮箱 poco("Mail").click() if poco("MailName").exists(): common.printgreen("进入邮箱功能") common.printgreen("点击邮件收取") poco("sqBtn").click() sleep(2) if poco("GreyModalDlg(Clone)").child("Bg").exists(): common.printgreen("没有可领取的邮件") sleep(1) poco("OK").click() if poco("MailDlg(Clone)").offspring("item0").exists(): common.printgreen( "邮箱有邮件,开始进行删除测试,因为删除是没有反馈的,所以只进行点击测试,拿不到结果") poco("MailDlg(Clone)").offspring("item0").child( "sign").click() poco("deletBtn").click() else: common.printred("没有进入邮箱界面,请检查") common.get_screen_shot(start, time.time(), devices, "没有进入邮箱界面") return poco("MailName").get_text() # 邮 件
def reward_dragon(start, poco, item, devices): # 分享奖励 poco("XSys_Reward_Dragon").click() with poco.freeze() as freezepoco: if freezepoco(texture="l_frame_02").exists() and \ freezepoco(text="本周助战次数:").exists() and \ freezepoco("Time").exists() and \ freezepoco("Agreement").exists() and \ freezepoco("Category").exists() and \ freezepoco("RewardDlg(Clone)").offspring("item0").exists() and \ freezepoco("RewardDlg(Clone)").offspring("item1").exists() and \ freezepoco("RewardDlg(Clone)").offspring("item2").exists() and \ freezepoco("RewardDlg(Clone)").offspring("item0").child("tmp2").exists() and \ freezepoco("RewardDlg(Clone)").offspring("item1").child("tmp2").exists() and \ freezepoco("tmp1").exists() and \ freezepoco("RewardDlg(Clone)").offspring("item1").child("Get").exists() and \ freezepoco("RewardDlg(Clone)").offspring("item2").child("Get").exists() and \ freezepoco("RewardDlg(Clone)").offspring("item0").child("Get").exists() and \ freezepoco("RewardDlg(Clone)").offspring("item0").child("Icon").exists() and \ freezepoco("RewardDlg(Clone)").offspring("item1").child("Icon").exists() and \ freezepoco("RewardDlg(Clone)").offspring("item2").child("Icon").exists(): common.printgreen("龙穴助战界面UI元素显示正常") else: common.printred("龙穴助战界面缺少UI元素,详情见截图") common.get_screen_shot(start, time.time(), devices, "龙穴助战界面缺少UI元素") # devices = "127.0.0.1:62001" # reward(devices)
def addheraldry(start, poco, devices): poco("Btn").click() but = poco("EquipCreateDlg(Clone)").offspring("WrapContent").offspring( name="Icon") # 是否存在金属板 if but.exists(): but.click() # 点击金属板 if poco("EquipCreateDlg(Clone)").offspring("Item").child( "Icon").exists(): # 制作窗口是否存在金属板 common.printgreen("开始进行纹章制作") poco("Create").click() # 纹章制作 # 是否存在制作纹章的弹窗 if poco("EquipCreateDlg(Clone)").offspring( "EquipSetCreateConfirmFrame").child("Bg").exists(): poco("OK").click() # 点击确定按钮 sleep(12) # 制作过程中等待10秒 if poco("Do").exists(): # 界面是否存在确定按钮 poco("Do").click() # 点击确定 sleep(3) poco("Close").click() # 点击返回,返回到纹章界面 else: common.printred("没有弹出金属板制作弹窗,请检查。。") common.get_screen_shot(start, time.time(), devices, "没有弹出金属板制作弹窗") else: if not but.exists(): # 如果界面不存在金属板 common.printred("没有金属板,没办法进行纹章制作", "blue") common.get_screen_shot(start, time.time(), devices, "没有金属板") poco("Close").click() # 点击返回,返回到纹章界面
def BtnConsider(start, poco, devices): # 研究 common.printgreen("进入研究界面") poco("NewGuildHall(Clone)").offspring("NewGuildInterior").offspring("item4").child("GO").click() freeze_poco = poco.freeze() # TODO:定义冻结poco if freeze_poco("item0").wait().exists() and \ freeze_poco("item1").wait().exists() and \ freeze_poco("item2").wait().exists() and \ freeze_poco("item3").wait().exists(): freeze_poco("GuildGrowthLabDlg(Clone)").offspring("item0").click() sleep(1) freeze_poco = poco.freeze() # TODO:定义冻结poco if freeze_poco("T").exists() and \ freeze_poco("GuildGrowthLabDlg(Clone)").offspring("Detail").child("Icon").exists() and \ freeze_poco("GuildGrowthLabDlg(Clone)").offspring("Detail").child("Name").exists() and \ freeze_poco("CurrentLevel").exists() and \ freeze_poco("CurrentAttr").exists() and \ freeze_poco("Tip").exists() and \ freeze_poco("Levelup").exists() and \ freeze_poco("Cost").exists(): # TODO:一下是循环点击升级,暂时屏蔽,以免造成不稳定的情况 # for item in range(len(freeze_poco("SkillList").child())): # item1 = "item" + str(item) # poco("GuildGrowthLabDlg(Clone)").offspring(item1).click() # 循环点击技能 # freeze_poco("Levelup").click() # 点击研究 poco("Close").click() close(poco) else: common.printred("工会研究所界面缺少元素,请检查。。。") common.get_screen_shot(start, time.time(), devices, "工会研究所界面缺少元素") poco("Close").click()
def BtnGz(start, poco, devices): # 工资 freeze_poco = poco.freeze() # TODO:定义dongjiepoco if freeze_poco("T").exists() and \ freeze_poco("Scoret").exists() and \ freeze_poco("Label").exists() and \ freeze_poco("GuildSalaryDlg(Clone)").offspring("frame").offspring("Up").offspring("Background").exists() and \ freeze_poco("GuildSalaryDlg(Clone)").offspring("frame").child("Left").child("Left").offspring("Background").exists() and \ freeze_poco("GuildSalaryDlg(Clone)").offspring("frame").offspring("Bottom").offspring("Background").exists() and \ freeze_poco("GuildSalaryDlg(Clone)").offspring("frame").child("Left").child("Right").offspring("Background").exists() and \ freeze_poco("GuildSalaryDlg(Clone)").offspring("frame").offspring("item0").exists() and \ freeze_poco("GuildSalaryDlg(Clone)").offspring("frame").offspring("item1").exists() and \ freeze_poco("p5").exists(): poco("GuildSalaryDlg(Clone)").offspring("frame").offspring( "Up").offspring("Background").click() # 点击 freeze_poco = poco.freeze() # TODO:定义dongjiepoco if freeze_poco("2").exists() and \ freeze_poco("0").exists() and \ freeze_poco("3").exists() and \ freeze_poco("1").exists() and \ freeze_poco("GuildSalaryDlg(Clone)").offspring("GuildSalaryDescDlg").child("Bg").offspring("Title")[0].exists(): poco("Close").click() else: common.printred("提升子界面缺少元素,请检查。。。") common.get_screen_shot(start, time.time(), devices, "活跃提升缺少元素") poco("Close").click() close(poco)
def dragonspirit(start, devices): poco = common.deviceconnect(devices) if poco("SysG_DragonSpirit").exists(): # 龙魂按钮存在 if poco("SysG_DragonSpirit").get_position()[0] > 1: # 界面有龙魂按钮 poco(texture="halln_4").click() poco("SysG_DragonSpirit").click() else: poco("SysG_DragonSpirit").click() freeze_poco = poco.freeze() # TODO:定义冻结poco if freeze_poco("DragonSpiritDlg(Clone)").offspring("AvatarPanel").child("item0").exists() and \ freeze_poco("DragonSpiritDlg(Clone)").offspring("AvatarPanel").child("item1").exists(): for item in poco("AvatarPanel").offspring("HeadIcon"): item.click() freeze_poco = poco.freeze() # TODO:定义冻结poco # 程序隐藏了5个控件,所以以下只点击5次 count = 0 for icon in freeze_poco("DragonSpiritDlg(Clone)").offspring( "Panel").offspring("lock"): icon.click() sleep(0.5) icon.click() count += 1 if count >= 5: break if poco("DragonSpiritSkillPreView").child("Bg").child( "p").exists(): icon.click() # 点击激活按钮 # poco("ActivationBtn").click() if poco(texture="l_frame_00").exists(): common.printred("没有激活道具。请补充。。") poco("ActivationBtn").click() break if poco("LevelUpBtn").exists(): common.printgreen("已经激活,开始喂养") poco("LevelUpBtn").click() if not poco("Title").exists(): # 如果没有弹出就重新点击 poco("LevelUpBtn").click() if poco("Title").exists(): # 喂养界面 if poco("DragonSpiritHandler").offspring( "LevelUpBtn").exists(): # 如果有喂养按钮 poco("DragonSpiritHandler").offspring( "LevelUpBtn").click() # 点击喂养 poco(texture="l_close_00").click() # 点击关闭 elif poco("DirectUpBtn").exists(): # 如果有突破按钮 poco("DirectUpBtn").click() # 点击突破 poco(texture="l_close_00").click() # 点击关闭 else: common.printred("没有弹出喂养界面,请检查。。。") common.get_screen_shot(start, time.time(), devices, "没有弹出喂养界面") if poco("ItemAccessDlg(Clone)").offspring("Title").exists(): freeze_poco("ActivationBtn").click() else: common.printred("龙魂界面控件缺失,请检查") common.get_screen_shot(start, time.time(), devices, "龙魂界面控件缺失") return poco("Total").child("Text").get_text() # 龙魂总属性
def Prof1_zhiye(start, poco,devices): """ 选择当前职业并点击确定 :return: """ poco("TurnProBtn").click() # 点击转职按钮 if poco("GreyModalDlg(Clone)").child("Bg").exists(): poco("OK").click() else: common.printred("ERROR:转职失败,请检查") common.get_screen_shot(start, time.time(), devices, "视频预览损坏")
def BtnRanking(start, poco, devices): # 排行 common.printgreen("进入排行榜界面") freeze_poco = poco.freeze() # TODO:定义冻结poco if freeze_poco("16").exists() and freeze_poco("17").exists() and freeze_poco("18").exists(): freeze_poco("16").click() freeze_poco("17").click() freeze_poco("18").click() else: common.printred("进入排行榜界面控件缺失,请检查。。。") common.get_screen_shot(start, time.time(), devices, "进入排行榜界面控件缺失") close(poco)
def UIjudge(start, poco, num, devices): sleep(3) freeze_poco = poco.freeze() # TODO:定义dongjiepoco if freeze_poco("NestName").exists() and freeze_poco("CurPPT").exists() and \ freeze_poco("SugPPT").exists() and freeze_poco("SugAttr").exists() and \ freeze_poco("SugLevel").exists() and freeze_poco("SugMember").exists(): common.printgreen("检查点: " + freeze_poco("CurPPT").child("T").get_text() + " " + freeze_poco("CurPPT").get_text() + " 显示正确") common.printgreen("检查点: " + freeze_poco("SugPPT").child("T").get_text() + " " + freeze_poco("SugPPT").get_text() + " 显示正确") common.printgreen("检查点: " + freeze_poco("SugAttr").child("T").get_text() + " " + freeze_poco("SugAttr").get_text() + " 显示正确") common.printgreen("检查点: " + freeze_poco("SugLevel").child("T").get_text() + " " + freeze_poco("SugLevel").get_text() + " 显示正确") common.printgreen("检查点: " + freeze_poco("SugMember").child("T").get_text() + " " + freeze_poco("SugMember").get_text() + " 显示正确") for item in range(len(freeze_poco("NestFrameNormal").child()) - num): item1 = "item" + str(item) common.printgreen( "检查点 " + freeze_poco("DragonNestDlg(Clone)").offspring( "NestFrameNormal").child(item1).child("Name").get_text() + " 显示正确") common.printgreen("进行点击奖励icon的操作") for item in range(len(freeze_poco("ItemList").child()) - 2): item2 = "item" + str(item) freeze_poco("DragonNestDlg(Clone)").offspring("ItemList").child( item2).click() freeze_poco("DragonNestDlg(Clone)").offspring("ItemList").child( item2).click() if poco("ItemToolTipDlg(Clone)").child("Bg").exists(): poco("DragonNestDlg(Clone)").offspring("ItemList").child( item2).click() # todo:进行两次判断,避免出现点击不及时的情况 if poco("ItemToolTipDlg(Clone)").child("Bg").exists(): poco("DragonNestDlg(Clone)").offspring("ItemList").child( item2).click() common.printgreen("奖励icon点击完成,报不报红暂时我就不管了") common.printgreen("点击 组队进入") poco("Enter").child("Text").click() if poco(text="队伍").exists(): common.printgreen("进入组队界面,开始点击返回按钮") poco("Close").click() if poco("Enter").exists(): common.printgreen("返回到龙穴界面") else: common.printred("点击组队后没有进入组队界面") common.get_screen_shot(start, time.time(), devices, "点击组队后没有进入组队界面")
def Btnfish(start, poco, devices): # 钓鱼 freeze_poco = poco.freeze() # TODO:定义dongjiepoco if poco("Title").exists(): for item in range(len(freeze_poco("ScrollView").child()) - 8): item1 = "item" + str(item) if freeze_poco("GuildFishDlg").child("Bg").offspring( "ScrollView").child(item1).exists(): pass poco(texture="l_close_00").click() # 点击返回 else: common.printred("没有进入工会钓鱼界面,请检查。。。") common.get_screen_shot(start, time.time(), devices, "没有进入工会钓鱼界面")
def share_reward(start, poco, item, devices): # 分享奖励 poco("XSys_WeekShareReward").click() with poco.freeze() as freezepoco: if freezepoco("item0").exists() and \ freezepoco("BtnShare").exists() and \ freezepoco("Label").exists() and \ freezepoco("WeekDesc").exists() and \ freezepoco("ActivityDes").exists(): common.printgreen("分享奖励界面UI元素显示正常") else: common.printred("分享奖励界面缺少UI元素,详情见截图") common.get_screen_shot(start, time.time(), devices, "分享奖励界面缺少UI元素")
def heraldry(start, devices): poco = common.deviceconnect(devices) if poco("SysAItem").get_position()[0] > 1: poco(texture="halln_4").click() sleep(1) poco("SysAItem").click() # 点击角色按钮 if poco("Title").exists(): common.printgreen("进入角色界面") if poco("XSys_Char_Emblem").exists(): poco("XSys_Char_Emblem").click() # 点击纹章 if poco("ItemNewDlg(Clone)").offspring("Items").child( "Frame").offspring("T").exists(): common.printgreen("进入金属板界面,开始进行纹章制作") # TODO:接下来进行纹章制作,纹章装备和卸下的操作已经完成 addheraldry(start, poco, devices) # 调用纹章制作 common.printgreen("进入纹章界面,开始测试纹章") but = poco("ItemNewDlg(Clone)").offspring(name="Icon") if but.exists(): but.click() # 点击已经装备的纹章 if poco("main").exists(): poco("Button1").click() # 点击卸下 if poco("ItemNewDlg(Clone)").offspring("Items").offspring( "Icon").exists(): but = poco("ItemNewDlg(Clone)").offspring( "Items").offspring(name="Icon") if but.exists(): but.click() # 点击第一个纹章 if poco("main").exists(): # 打开纹章装备界面 poco("Button1").click() # 点击装备 common.get_screen_shot(start, time.time(), devices, "装备纹章截图验证") but = poco("ItemNewDlg(Clone)").offspring(name="Icon") if but.exists(): but.click() # 点击已经装备的纹章 if poco("main").exists(): poco("Button1").click() # 点击卸下 else: common.printgreen("点击纹章后没有打开纹章装备界面") common.get_screen_shot(start, time.time(), devices, "点击纹章后没有打开纹章装备界面") else: common.printred("没有纹章,请添加文章后进行操作") common.get_screen_shot(start, time.time(), devices, "没有纹章") else: common.printred("没有进入角纹章界面,请检查。。") common.get_screen_shot(start, time.time(), devices, "没有进入角色") else: common.printred("没有进入角色,请检查。。") common.get_screen_shot(start, time.time(), devices, "没有进入角色") return poco("ItemNewDlg(Clone)").offspring("EmblemListPanel").child( "Frame").offspring("T").get_text() # 纹章
def design_achieve(start, poco, item, devices): # 成就奖励 poco("XSys_Design_Achieve").click() try: with poco.freeze() as freezepoco: count = freezepoco("padTabs").child() for i in range(len(count)): TabTpl = "TabTpl" + str(i) freezepoco("padTabs").child(TabTpl).click() common.printgreen("成就界面按钮点击正常") except Exception as e: common.printred("成就界面按钮点击异常") common.printred(e) common.get_screen_shot(start, time.time(), devices, "成就界面按钮点击异常")
def level_reward(start, poco, item, devices): # 等级奖励 poco("XSys_LevelReward").click() with poco.freeze() as freezepoco: if freezepoco("Panel").exists() and \ freezepoco("T1").exists() and \ freezepoco("T3").exists() and \ freezepoco("T4").exists() and \ freezepoco("Panel").offspring("Name").exists() and \ freezepoco("RewardDlg(Clone)").offspring("Panel").offspring("Fetch").exists() and \ freezepoco("RewardDlg(Clone)").offspring("Panel").offspring("ItemReward").exists(): common.printgreen("等级奖励界面UI元素显示正常") else: common.printred("等级奖励界面缺少UI元素,详情见截图") common.get_screen_shot(start, time.time(), devices, "等级奖励界面缺少UI元素")
def witness(start, devices): poco = common.deviceconnect(devices) if poco("SysG_Live").exists(): poco("SysG_Live").click() freeze_poco = poco.freeze() # TODO:定义dongjiepoco if freeze_poco("SpectateDlg(Clone)").offspring("Name").exists(): for Label in freeze_poco("SpectateDlg(Clone)").offspring("SpectateFrame").\ offspring("Bg").offspring("TextLabel"): Label.click() # 点击观战的多项子页签 freeze_poco("Refresh").click() # 点击刷新按钮 freeze_poco("1").click() # 点击我的记录 freeze_poco = poco.freeze() # TODO:定义dongjiepoco if freeze_poco("Watch").exists() and freeze_poco("Commend").exists(): pass poco("Text").click() # 点击观战设置 freeze_poco = poco.freeze() # TODO:定义dongjiepoco if freeze_poco("BtnDeny").exists() and freeze_poco("BtnAllow").exists() and freeze_poco("Ok").exists(): freeze_poco("SpectateDlg(Clone)").offspring("BtnDeny").child("BtnHigh").click() # 点击不允许被观战 common.printgreen("点击不允许被观战") common.get_screen_shot(start, time.time(), devices, "点击不允许被观战") freeze_poco("SpectateDlg(Clone)").offspring("BtnAllow").child("BtnHigh").click() # 点击允许被观战 common.printgreen("点击允许被观战") sleep(0.5) common.get_screen_shot(start, time.time(), devices, "点击允许被观战") return poco("Label").get_text() # 保存设置 else: common.printred("没有进入观战界面,请检查。。。") common.get_screen_shot(start, time.time(), devices, "没有进入观战界面") else: common.printred("主界面没有有观战按钮,请检查。。。") common.get_screen_shot(start, time.time(), devices, "主界面没有有观战按钮")
def Btnfish(start, poco, devices): # 钓鱼 common.printgreen("进入钓鱼界面") poco("NewGuildHall(Clone)").offspring("NewGuildWelfare").offspring("item4").child("GO").click() freeze_poco = poco.freeze() # TODO:定义冻结poco if poco("Title").exists(): for item in range(len(freeze_poco("ScrollView").child())): item1 = "item" + str(item) if freeze_poco("NewGuildHall(Clone)").offspring("GuildFishDlg").child("Bg")\ .offspring("ScrollView").child(item1).exists(): pass poco(texture="l_close_00").click() # 点击返回 else: common.printred("没有进入工会钓鱼界面,请检查。。。") common.get_screen_shot(start, time.time(), devices, "没有进入工会钓鱼界面")
def fetters(start, devices): poco = common.deviceconnect(devices) if poco("SysE_NPCFavor").exists(): # 羁绊按钮存在 if poco("SysE_NPCFavor").get_position()[0] > 1: # 界面有羁绊按钮 poco(texture="halln_4").click() poco("SysE_NPCFavor").click() else: poco("SysE_NPCFavor").click() freeze_poco = poco.freeze() # TODO:定义冻结poco if freeze_poco("BookBg").exists() and \ freeze_poco("TabTpl0").exists() and \ freeze_poco("TabTpl2").exists() and \ freeze_poco("TabTpl1").exists(): # 点击好感度 for TabTp in freeze_poco("Tabs").offspring("Bg"): TabTp.click() freeze_poco = poco.freeze() # TODO:定义冻结poco try: if freeze_poco("WrapContent").offspring("NpcName").exists(): for Npcname in freeze_poco("WrapContent").offspring("NpcName"): common.printgreen(f"检查点 {Npcname.get_text()} 显示正确") if freeze_poco("WrapContent").offspring("GroupName").exists(): for Npcname in freeze_poco("WrapContent").offspring("GroupName"): common.printgreen(f"检查点 {Npcname.get_text()} 显示正确") except PocoNoSuchNodeException: pass # TODO:以下代码为激活状态下的操作 common.printgreen("点击好感度") poco("TabTpl0").click() # 点击好感度 if poco("NpcInfo").child("Activation").child("RedPoint").exists(): if poco("NpcInfo").child("Activation").child("RedPoint").get_position()[0] < 1: # 可激活按钮存在 common.printgreen("点击激活") poco("NpcInfo").child("Activation").click() # 点击激活 if poco("GoBtn").exists(): # 前往赠送按钮存在 if poco("GoBtn").get_position()[0] < 1: common.printgreen("点击前往赠送") poco("GoBtn").click() # 点击前往赠送 if poco("BtnSend").wait(30).exists(): # 等待出现对话框 poco().click([0.5, 0.5]) # 出现了对话框就点击屏幕中间 return "羁绊" else: common.printred("没有出现对话框,请检查") common.get_screen_shot(start, time.time(), devices, "没有出现对话框") else: common.printred("羁绊界面控件缺失,请检查") common.get_screen_shot(start, time.time(), devices, "羁绊界面控件缺失") return poco(texture="l_tip_00").child("T").get_text() # 羁绊
def Donation(start, poco, devices): # 捐赠 freeze_poco = poco.freeze() # TODO:定义dongjiepoco if freeze_poco("T").exists() and freeze_poco("RankBtn").exists(): poco("RankBtn").click() # 点击排行榜 freeze_poco = poco.freeze() # TODO:定义dongjiepoco if freeze_poco("Tittle").exists() and \ freeze_poco("All").exists() and \ freeze_poco("Self").exists() and \ freeze_poco(text="排名").exists() and \ freeze_poco("Top").child("T")[2].exists() and \ freeze_poco(text="角色").exists(): poco("Self").child("TextLabel").click() # 点击历史排名 freeze_poco = poco.freeze() # TODO:定义dongjiepoco if freeze_poco(text="排名").exists() and \ freeze_poco("Top").child("T")[2].exists() and \ freeze_poco(text="角色").exists(): poco(texture="l_close_00").click() else: common.printred("捐赠历史排行界面元素缺失,请检查。。。") common.get_screen_shot(start, time.time(), devices, "捐赠历史排行界面元素缺失") poco(texture="l_close_00").click() else: common.printred("捐赠今日排行界面元素缺失,请检查。。。") common.get_screen_shot(start, time.time(), devices, "捐赠今日排行界面元素缺失") poco(texture="l_close_00").click() poco("GrowthDonation").click() # 点击资材收集 freeze_poco = poco.freeze() # TODO:定义dongjiepoco for item in range(len(freeze_poco("List").child())): item1 = "item" + str(item) if freeze_poco(item1).exists() and freeze_poco(item1).child( "Do").exists() and freeze_poco("box").exists(): freeze_poco(item1).child("Do").click() # 点击缴纳 else: common.printred("捐赠今日排行界面元素缺失,请检查。。。") common.get_screen_shot(start, time.time(), devices, "捐赠今日排行界面元素缺失") poco("RecordBtn").click() # 点击捐献记录 if poco("Tittle").exists(): poco(texture="l_close_00").click() else: common.printred("捐赠记录没有弹出,请检查。。。") common.get_screen_shot(start, time.time(), devices, "捐赠记录没有弹出") poco("WeeklyDonation").click() # 点击悬赏捐赠 if poco("Bg2").exists(): close(poco) else: common.printred("悬赏捐赠,请检查。。。") common.get_screen_shot(start, time.time(), devices, "悬赏捐赠")
def reward_target(start, poco, item, devices): # 目标奖励 poco("XSys_Reward_Target").click() try: with poco.freeze() as freezepoco: count = freezepoco("padTabs").child("TabList").child() for i in range(len(count)): if i == 2: TabTpl = "TabTpl3" else: TabTpl = "TabTpl" + str(i) freezepoco("padTabs").child("TabList").child(TabTpl).click() common.printgreen("目标奖励界面按钮点击正常") except Exception as e: common.printred("目标奖励界面按钮点击异常") common.printred(e) common.get_screen_shot(start, time.time(), devices, "目标奖励界面按钮点击异常")
def BtnSkill(start, poco, devices): # 技能 freeze_poco = poco.freeze() # TODO:定义dongjiepoco for skill in range(1, len(freeze_poco("SkillList").child())): skill1 = "Skill" + str(skill) if freeze_poco(skill1).exists(): pass else: common.printred("工会技能缺失,请检查。。。") common.get_screen_shot(start, time.time(), devices, "工会技能缺失") if freeze_poco("texbg").exists() and \ freeze_poco("Name").exists() and \ freeze_poco("Levelup").exists(): pass else: common.printred("工会技能界面元素缺失,请检查。。。") common.get_screen_shot(start, time.time(), devices, "工会技能界面元素缺失") freeze_poco("Levelup").click() # 点击升级按钮,没办法做是否成功的判断 close(poco)
def PlayerBg(start, poco, devices): # 政厅 common.printgreen("进入政厅界面") poco("NewGuildHall(Clone)").offspring("NewGuildInterior").offspring("item3").child("GO").click() freeze_poco = poco.freeze() # TODO:定义冻结poco if freeze_poco("GuildGrowthBuffDlg(Clone)").offspring("Detail").child("Name").exists() and \ freeze_poco("MaxLevel").exists() and \ freeze_poco("CurrentLevel").exists() and \ freeze_poco("CurrentAttr").exists() and \ freeze_poco("Levelup").exists(): # TODO:一下是循环点击升级,暂时屏蔽,以免造成不稳定的情况 # for item in range(len(freeze_poco("SkillList").child())): # item1 = "item" + str(item) # poco("GuildGrowthBuffDlg(Clone)").offspring(item1).click() # 循环点击技能 # freeze_poco("Levelup").click() # 点击升级按钮 poco("Close").click() else: common.printred("工会政厅界面缺少元素,请检查。。。") common.get_screen_shot(start, time.time(), devices, "工会政厅界面缺少元素") poco("Close").click()
def Skillpng(start, poco,devices): """ 在主界面查找技能按钮 找不到就点击+号 :return: """ if poco("SkillTree(Clone)").offspring("Type").get_text() == "被动技能": pass else: if poco("Play").exists(): poco("Play").click() for i in range(15): sleep(1) if poco("Play").exists(): break else: common.printred("视频预览损坏,请检查...") common.get_screen_shot(start, time.time(), devices, "视频预览损坏")
def reward(start, devices): poco = common.deviceconnect(devices) if poco("Duck").exists(): poco("Duck").click() sleep(2) poco("XSys_Activity").click() # 点击日常按钮 else: common.printgreen("主界面缺少日常按钮,请检查...") common.get_screen_shot(start, time.time(), devices, "主界面缺少日常按钮") pos = poco("DailyActivityDlg(Clone)").offspring("XActivityHandler").offspring("Item904").offspring("Background") # 悬赏任务参加按钮 if pos.exists(): butpos(devices,butpos=pos, pos1=0.4, pos2=0.79, high=565, low=511, lows=240) # 调用butpos方法 pos.click() # 点击日常任务参加按钮 else: common.printgreen("日常界面没有悬赏任务选项,请检查...") common.get_screen_shot(start, time.time(), devices, "日常界面没有悬赏任务选项") if not poco(text="联盟悬赏").exists(): # 判断是否已经接了任务 common.printgreen("还未接取任务,开始接任务") sleep(30) for i in range(5): if poco("TalkTextBg").child("Bg").exists(): # 如果弹出了任务弹窗 poco("VirtualTab").click() # 点击下一步 if poco("BtnOK").exists(): # 如果出现了接受按钮 common.printgreen("接受任务") poco("BtnOK").click() # 点击接受 break if poco(text="联盟悬赏").exists(): # 判断是否已经接了任务 freeze_poco = poco.freeze() # TODO:定义冻结poco common.printgreen("已经接了悬赏任务,开始检测任务模块控件") if freeze_poco("Bg2").exists() and freeze_poco("ChestX").exists() and freeze_poco("RightItem").exists() and \ freeze_poco("Text").exists() and freeze_poco("TaskRewards").exists() and freeze_poco("RefreshBtn").exists() and \ freeze_poco("CommitBtn").exists() and freeze_poco("BountyList").exists(): common.printgreen("悬赏任务模块控件元素判断完毕,开始判断悬赏任务") for item in range(len(freeze_poco("BountyList").child())): item1 = "item" + str(item) if freeze_poco("BountyList").child(item1).exists(): pass else: common.printred("悬赏任务缺失,请检查...") common.get_screen_shot(start, time.time(), devices, "悬赏任务缺失") common.printgreen("悬赏任务判断完毕,开始判断刷新任务模块") if poco("FreeLabel").exists(): if int(poco("FreeLabel").get_text()[-3]) > 0: # 刷新次数 common.printgreen("任务还有刷新次数,点击刷新") poco("RefreshBtn").click() elif poco(text="刷新").exists(): # 刷新次数 common.printgreen("任务没有刷新次数了,我准备用龙币刷新,我钱多。。。") poco("RefreshBtn").click() common.printgreen("好了,我用龙币帮你刷新了。。。\n还有我没有点击前往,因为前往都是模块本身,这些模块都会有自己的脚本。。。") else: common.printred("刷新按钮缺失,请检查...") common.get_screen_shot(start, time.time(), devices, "刷新按钮缺失") return poco("CommitBtn").child("T").get_text()