From b004ac5d1ce13301afaccb21f16aabed47df9748 Mon Sep 17 00:00:00 2001 From: Break27 Date: Fri, 14 Aug 2026 15:30:44 +0800 Subject: [PATCH] fix: removed busy wait --- main.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/main.py b/main.py index f8e6d73..07b083b 100644 --- a/main.py +++ b/main.py @@ -196,6 +196,10 @@ def main(driver: Chrome, logger = logging.getLogger('main')): result = wb.active.cell(row, headers.index(header) + 1) return result + def busy(driver: Chrome): + result = driver.find_elements(By.CSS_SELECTOR, ".io-ox-busy") + return result + try: click("li[data-id='default0/Brouillons']", condition=EC.presence_of_element_located) click("button[data-id='default0/Brouillons']", condition=EC.presence_of_element_located) @@ -213,12 +217,6 @@ def main(driver: Chrome, logger = logging.getLogger('main')): @classmethod def perform(cls): - try: busy = driver.find_elements(By.CSS_SELECTOR, ".io-ox-busy") - except: busy = None - - if busy: - sleep(parameters['interval']) - return True if status == Status.RUNNING: timer.start() return False @@ -450,7 +448,8 @@ def main(driver: Chrome, logger = logging.getLogger('main')): flow.react(Wait) click("ul.classic-toolbar button[aria-label='Edit copy']") - flow.react(Wait) + until(lambda x: busy(x)) + until(lambda x: not busy(x)) locate("div.io-ox-mail-compose-window iframe", condition=EC.frame_to_be_available_and_switch_to_it) if options.get('greet') and not (clean := False):