From 75e64176208e152d3b0d76c4e1ca6f33d5482036 Mon Sep 17 00:00:00 2001 From: YoursFunny Date: Fri, 3 Nov 2023 21:42:22 +0800 Subject: [PATCH] feat: add function for button click with interval --- module/base/base.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/module/base/base.py b/module/base/base.py index 496e55b..d097c7f 100644 --- a/module/base/base.py +++ b/module/base/base.py @@ -128,6 +128,14 @@ class ModuleBase: self.device.click(button) return appear + def click_with_interval(self, button, interval=5): + if interval and not self.interval_is_reached(button, interval=interval): + return False + self.device.click(button) + if interval: + self.interval_reset(button, interval=interval) + return True + def wait_until_stable(self, button, timer=Timer(0.3, count=1), timeout=Timer(5, count=10)): """ A terrible method, don't rely too much on it.