diff --git a/邮件批量发送脚本.py b/邮件批量发送脚本.py index 0b3aa1c..95b3091 100644 --- a/邮件批量发送脚本.py +++ b/邮件批量发送脚本.py @@ -329,15 +329,16 @@ def main(): try: wait = WebDriverWait(driver, timeout=args.interval) alert = wait.until(lambda x: x.find_element(By.CSS_SELECTOR, "div.io-ox-alert.io-ox-alert-error")) - + + sents[current] = '❌' message = alert.text.replace('\n', ' ') - if not message: print(f'[警告] 程序异常。请保持页面在前台显示,避免遮挡或最小化') - else: print(f'[警告] ({attempt}): {message}') + if not message: raise Exception('程序异常。请保持页面在前台显示,避免遮挡或最小化') + print(f'[警告] ({attempt}): {message}') # 关闭警告 click("div.io-ox-alert.io-ox-alert-error button[data-action='close']") except TimeoutException: - sents[current] = '✔' + sents[current] = '✔️' occurrence[0] += 1 sent += 1 break