minor fix

This commit is contained in:
2026-06-12 14:44:18 +08:00
parent 510a664b04
commit 5bef39bb41
+3 -6
View File
@@ -19,6 +19,7 @@ from common.actionflow import Action, ActionFlow
from io import BytesIO
from enum import Enum
from wakepy import keep
from typing import Callable
from pathlib import Path
from datetime import datetime
from openpyxl import Workbook
@@ -150,13 +151,9 @@ def main(driver: Chrome, logger = logging.getLogger('main')):
busy = driver.find_element(By.CSS_SELECTOR, ".io-ox-busy")
return busy
def catch(predicate, force=True):
try:
def catch(predicate: Callable[[Chrome], WebElement]):
wait = WebDriverWait(driver, timeout=parameters['interval'])
return wait.until(predicate, 'Timeout')
except Exception as e:
if force: raise e
return None
try:
driver.switch_to.new_window('tab')
@@ -537,7 +534,7 @@ def main(driver: Chrome, logger = logging.getLogger('main')):
continue
try:
alert: WebElement = catch(lambda x: x.find_element(By.CSS_SELECTOR, "div.io-ox-alert.io-ox-alert-error"))
alert = catch(lambda x: x.find_element(By.CSS_SELECTOR, "div.io-ox-alert.io-ox-alert-error"))
message = alert.text.replace('\n', ' ')
cell(index, column.sent).value = ''