minor fix
This commit is contained in:
@@ -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)
|
||||
|
||||
# 发送邮件
|
||||
|
||||
Reference in New Issue
Block a user