def click_somewhere_to_wait(self, device): self.wait(3) if self.option: option_image = Image(os.path.join(os.path.dirname(self.name), self.option)) while not self.exists(device): somewhere = Point("somewhere", randrange(105, 575), randrange(90, 350)) somewhere.click(device) self.wait(2) if option_image.exists(device): option_image.click(device)
def click_somewhere_to_wait(self, device): while not self.exists(device): somewhere = Point("somewhere", randrange(105, 575), randrange(90, 350)) somewhere.click(device) if self.support_again.exists(device): self.ok_button.click(device) self.wait(3) elif self.back_button.exists(device): self.back_button.click(device) self.wait(3) elif self.return_button.exists(device): self.return_button.click(device) self.wait(3)
step.swipe(device) else: step.click(device) if 'location' in step.note and cancel_button.exists( device): cancel_button.click(device) time.sleep(1) def show_steps(self): self.steps.show_steps() class StepList(list): def show_steps(self): start_war_flag = 'start_war' for step in self: print(step) if start_war_flag in step.note: print("\nBattle") if __name__ == '__main__': import atx device = atx.connect('4200c49cf2faa381') point = Point('location4', 534, 122) cancel_button = Image( os.path.join(constant.BATTLE_COMMON_IMAGE_DIR, 'cancel_button')) point.click(device) if 'location' in point.note and cancel_button.exists(device): cancel_button.click(device)