def main_loop(self): dr = self.driver m008 = self.machine008 while True: try: dr.press_keycode(3) time.sleep(1) dr.press_keycode(3) time.sleep(1) #清后台 # dr.press_keycode(82) # time.sleep(1) # WebDriverWait(dr, 10).until(lambda d: d.find_element_by_id("com.android.systemui:id/clearButton")).click() # time.sleep(1) MachineVPN(dr).run() m008.run() # dr.press_keycode(3) # time.sleep(1) # dr.press_keycode(3) # time.sleep(1) # WebDriverWait(dr, 30).until(lambda d: d.find_element_by_name(self.appname)).click() # time.sleep(5) # 开启加速 # dr.press_keycode(3) # time.sleep(1) # WebDriverWait(dr, 30).until(lambda d: d.find_element_by_name("GMD Speed Time")).click() # time.sleep(1) # WebDriverWait(dr, 30).until(lambda d: d.find_element_by_id("com.gmd.speedtime:id/buttonStart")).click() # time.sleep(2) dr.press_keycode(3) time.sleep(1) WebDriverWait(dr, 30).until( lambda d: d.find_element_by_name(self.appname)).click() time.sleep(15) #记录ip self.log_ip() dr.press_keycode(3) time.sleep(5) WebDriverWait(dr, 30).until( lambda d: d.find_element_by_name(self.appname)).click() time.sleep(1) #关闭加速 # dr.press_keycode(3) # time.sleep(1) # WebDriverWait(dr, 30).until(lambda d: d.find_element_by_name("嘀嗒拼车")).click() # time.sleep(5) # WebDriverWait(dr, 30).until(lambda d: d.find_element_by_id("com.gmd.speedtime:id/buttonStop")).click() # time.sleep(1) # dr.press_keycode(3) # time.sleep(1) except Exception as e: print("somting wrong") print(e) finally: pass print("Again\n") return self.exit
def main_loop(self): dr = self.driver m008 = self.machine008 m = self.machine while True: try: MachineVPN(dr).run() m008.run() ############# # m.set_chanel_mission(MachineQD(m, app_time_map)) m.run() except Exception as e: print("somting wrong") print(e) alert() check_crash(dr) finally: pass print("Again\n") # show_message("Again\n") alert() return self.exit
def main_loop(self): dr = self.driver m008 = self.machine008 m1 = self.machine1 m2 = self.machine2 self.is_send = False # mlocation = self.machinelocation #切换脚本输入法 dr.press_keycode(63) time.sleep(1) dr.find_element_by_name( "Appium Android Input Manager for Unicode").click() time.sleep(1) while True: try: dr.press_keycode(3) time.sleep(1) dr.press_keycode(3) time.sleep(1) dr.press_keycode(66) time.sleep(1) dr.press_keycode(66) time.sleep(1) #清后台 # dr.press_keycode(82) # time.sleep(1) # WebDriverWait(dr, 10).until(lambda d: d.find_element_by_id("com.android.systemui:id/clearButton")).click() # time.sleep(1) # 上传记录文件 # if time.localtime().tm_hour == 8 and time.localtime().tm_min >= 30: # try: # self.upload_file(choice(['192.168.2.108', '10.0.0.22']), ["userhuajiao.log", "timehuajiao.log", "timehuajiao2.log"]) # except: # pass #发邮件 # if time.localtime().tm_hour == 8 and not self.is_send: # self.sms() # self.is_send = True # if time.localtime().tm_hour == 11: # self.is_send = False #计数器清0 if time.localtime().tm_hour == 0 and self.runnum > 12: self.runnum = 0 MachineVPN(dr).run() m008.run() #定位 # mlocation.latnum = random.randint(35, 37)+random.randint(50000, 450000)/1000000 # mlocation.lotnum = random.randint(116, 118)+random.randint(300000, 350000)/1000000 # mlocation.run() #周末控制效率 # if m008.remain_day == '1' and (time.localtime().tm_wday == 5 or time.localtime().tm_wday == 6): # print("周末激活暂停1800s....") # time.sleep(1800) # continue if m008.remain_day == '1': print("激活") m1.imei = m008.imei m1.runnum = self.runnum m1.run() self.runnum += 1 #控制激活量 # self.ctrl_new("", 100, 1800) #filename, num, sleep_time else: print("留存") m2.imei = m008.imei m2.remain_day = m008.remain_day m2.run() except Exception as e: print("somting wrong") print(e) finally: pass print("Again\n") return self.exit
def main_loop(self): dr = self.driver m008 = self.machine008 m1 = self.machine1 m2 = self.machine2 self.is_send = False # mlocation = self.machinelocation #切换脚本输入法 dr.press_keycode(63) time.sleep(1) dr.find_element_by_name("Appium Android Input Manager for Unicode").click() time.sleep(1) while True: try: dr.press_keycode(3) time.sleep(1) dr.press_keycode(3) time.sleep(1) dr.press_keycode(66) time.sleep(1) dr.press_keycode(66) time.sleep(1) #清后台 # dr.press_keycode(82) # time.sleep(1) # WebDriverWait(dr, 10).until(lambda d: d.find_element_by_id("com.android.systemui:id/clearButton")).click() # time.sleep(1) #上传记录文件 # if time.localtime().tm_hour == 8 and time.localtime().tm_min >= 30: # self.upload_file() #周末控制效率 # if m008.frist_day and (time.localtime().tm_wday == 5 or time.localtime().tm_wday == 6): # print("周末激活暂停1800s....") # time.sleep(1800) #发邮件 # if time.localtime().tm_hour == 8 and not self.is_send: # self.sms() # self.is_send = True # if time.localtime().tm_hour == 11: # self.is_send = False #计数器清0 if time.localtime().tm_hour == 0 and self.runnum > 12: self.runnum = 0 MachineVPN(dr).run() #留存率设置 m008.remain_rate = [50, 45, 40, 35, 30, 25, 20, 15, 10, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, ] m008.frist_day = self.st[time.localtime().tm_hour-1] #留存做完是否跳转做激活 True/False m008.change = False #留存天数设定 m008.remain_day = 7 #添加留存从什么时候开始 # m008.begin_time_month = 9 # m008.begin_time_day = 29 #备份还原 # m008.task_schedule = ["do_all_one_key", "modify_data"] m008.run() #定位 # mlocation.latnum = random.randint(35, 37)+random.randint(50000, 450000)/1000000 # mlocation.lotnum = random.randint(116, 118)+random.randint(300000, 350000)/1000000 # mlocation.run() if m008.frist_day == 1: print("激活") m1.imei = m008.imei m1.runnum = self.runnum m1.run() self.runnum += 1 #备份还原 # m008.task_schedule = ["backup_app_lib"] # m008.run() #控制激活量 # self.ctrl_new("", 100, 1800) #filename, num, sleep_time elif m008.frist_day == 2: print("留存已完成暂停30分钟") time.sleep(1800) else: print("留存") m2.imei = m008.imei #备份还原 # m008.task_schedule = ["recovery_app_lib"] # m008.run() m2.run() #备份还原 # m008.task_schedule = ["backup_app_lib"] # m008.run() except Exception as e: print("somting wrong") print(e) finally: pass print("Again\n") return self.exit
def main_loop(self): dr = self.driver m008 = self.machine008 #切换脚本输入法 dr.press_keycode(63) time.sleep(1) dr.find_element_by_name( "Appium Android Input Manager for Unicode").click() time.sleep(1) while True: try: dr.press_keycode(3) time.sleep(1) dr.press_keycode(3) time.sleep(1) dr.press_keycode(66) time.sleep(1) dr.press_keycode(66) time.sleep(1) #清后台 # dr.press_keycode(82) # time.sleep(1) # WebDriverWait(dr, 10).until(lambda d: d.find_element_by_id("com.android.systemui:id/clearButton")).click() # time.sleep(1) #计数器清0 if time.localtime().tm_hour == 0 and self.runnum > 12: self.runnum = 0 MachineVPN(dr).run() m008.run() dr.press_keycode(3) time.sleep(1) WebDriverWait(dr, 30).until( lambda d: d.find_element_by_name("文件管理")).click() time.sleep(1) try: WebDriverWait(dr, 10).until( lambda d: d.find_element_by_name("安装包")).click() time.sleep(1) except TimeoutException: dr.press_keycode(4) time.sleep(1) WebDriverWait(dr, 10).until( lambda d: d.find_element_by_name("安装包")).click() time.sleep(1) WebDriverWait(dr, 30).until(lambda d: d.find_element_by_name( "htscCFTApp110.apk")).click() time.sleep(1) try: WebDriverWait(dr, 30).until( lambda d: d.find_element_by_name("安装")).click() time.sleep(1) except TimeoutException: WebDriverWait(dr, 30).until( lambda d: d.find_element_by_name("替换")).click() time.sleep(1) WebDriverWait(dr, 30).until( lambda d: d.find_element_by_name("安装")).click() time.sleep(1) WebDriverWait( dr, 180).until(lambda d: d.find_element_by_name("打开")).click() time.sleep(5) WebDriverWait(dr, 180).until(lambda d: d.find_element_by_id( "com.lphtsccft:id/introduceRadioGroup")) self.begintime = "开始:%s:%s:%s" % (time.localtime().tm_hour, time.localtime().tm_min, time.localtime().tm_sec) for _ in range(2): dr.swipe(300, 600, 300, 200) time.sleep(1) WebDriverWait(dr, 180).until(lambda d: d.find_element_by_id( "com.lphtsccft:id/introducePageViewPager")).click() time.sleep(5) for _ in range(3): dr.press_keycode(4) time.sleep(1) try: WebDriverWait(dr, 5).until( lambda d: d.find_element_by_name("确定")).click() time.sleep(1) break except TimeoutException: pass dr.press_keycode(4) time.sleep(1) dr.press_keycode(4) time.sleep(1) #记录时间 self.endstime = "结束:%s:%s:%s" % (time.localtime().tm_hour, time.localtime().tm_min, time.localtime().tm_sec) print(self.begintime) print(self.endstime) try: with open('/sdcard/1/timeaaaaa.log', 'a') as f: f.write( '\n激活 %s.%s, %s, %s, count:%s' % (time.localtime().tm_mon, time.localtime().tm_mday, self.begintime, self.endstime, self.runnum)) except: pass time.sleep(1) except Exception as e: print("somting wrong") print(e) finally: pass print("Again\n") return self.exit
def main_loop(self): dr = self.driver # m008 = self.machine008 m1 = self.machine1 m2 = self.machine2 #切换脚本输入法 dr.press_keycode(63) time.sleep(1) dr.find_element_by_name( "Appium Android Input Manager for Unicode").click() time.sleep(1) while True: try: dr.press_keycode(3) time.sleep(1) dr.press_keycode(3) time.sleep(1) dr.press_keycode(66) time.sleep(1) dr.press_keycode(66) time.sleep(1) #清后台 dr.press_keycode(82) time.sleep(1) WebDriverWait(dr, 10).until(lambda d: d.find_element_by_id( "com.android.systemui:id/clearButton")).click() time.sleep(1) #上传记录文件 # if time.localtime().tm_hour == 8 and time.localtime().tm_min >= 30: # self.upload_file() #计数器清0 if time.localtime().tm_hour == 0 and self.runnum > 12: self.runnum = 0 MachineVPN(dr).run() WebDriverWait(dr, 10).until( lambda d: d.find_element_by_name("APP快捷")).click() time.sleep(20) m1.runnum = self.runnum m1.run() # m008.run() #周末控制效率 # if m008.remain_day == '1' and (time.localtime().tm_wday == 5 or time.localtime().tm_wday == 6): # print("周末激活暂停1800s....") # time.sleep(1800) # continue # if m008.remain_day == '1': # print("激活") # m1.imei = m008.imei # m1.runnum = self.runnum # m1.run() # self.runnum += 1 #控制激活量 # self.ctrl_new("", 100, 1800) #filename, num, sleep_time # else: # print("留存") # m2.imei = m008.imei # m2.remain_day = m008.remain_day # m2.run() except Exception as e: print("somting wrong") print(e) finally: pass print("Again\n") return self.exit