From 224932cec91356ec824081bb8831f457a5977f2d Mon Sep 17 00:00:00 2001 From: break27 Date: Mon, 7 Jul 2025 15:10:22 +0800 Subject: [PATCH] minor fix --- 邮件批量发送脚本.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/邮件批量发送脚本.py b/邮件批量发送脚本.py index 2042a4e..9fb9bd1 100644 --- a/邮件批量发送脚本.py +++ b/邮件批量发送脚本.py @@ -59,10 +59,10 @@ def main(): print(f'[!!!!] 初始化时发生了错误:{e}') return 2 - def locate(selector, condition=EC.presence_of_element_located): + def locate(selector, condition=EC.presence_of_element_located, parent=driver): while True: try: - wait = WebDriverWait(driver, timeout=args.timeout) + wait = WebDriverWait(parent, timeout=args.timeout) return wait.until(condition((By.CSS_SELECTOR, selector))) except StaleElementReferenceException: # 如果遇到过期元素,重新尝试查找 @@ -190,7 +190,9 @@ def main(): click("div.io-ox-mail-compose-window div.floating-header") # 填入收件人 - to = locate("div.io-ox-mail-compose-window input.token-input.tt-input[tabindex='0']") + wrapper = locate("div.io-ox-mail-compose-window div[data-extension-id='to'] > div.mail-input") + to = locate("input.token-input.tt-input[tabindex='0']", parent=wrapper) + click(wrapper) to.send_keys(recipient) # 发送邮件