update: removed recovery functionality
This commit is contained in:
@@ -100,8 +100,8 @@
|
||||
<label for="greet" class="pure-checkbox">
|
||||
<input id="greet" type="checkbox"/> Greet recipients (by proper names if possible)
|
||||
</label>
|
||||
<label for="recovery" class="pure-checkbox">
|
||||
<input id="recovery" type="checkbox"/> Try recover from a mismatched address/subject error
|
||||
<label for="force" class="pure-checkbox">
|
||||
<input id="force" type="checkbox"/> Ignore address/subject mismatch errors
|
||||
</label>
|
||||
<label for="slice" class="pure-checkbox">
|
||||
<input id="slice" type="checkbox"/> Enable task slicing
|
||||
|
||||
32
main.py
32
main.py
@@ -283,9 +283,9 @@ def main(driver: Chrome, logger = logging.getLogger('main')):
|
||||
flow.append(Skip)
|
||||
|
||||
sp.set('actions', lambda: flow.capabilities())
|
||||
sp.set('cancel', lambda: flow.do(Cancel))
|
||||
sp.set('close', lambda: flow.do(Close))
|
||||
sp.set('skip', lambda: flow.do(Skip))
|
||||
sp.set('cancel', lambda: flow.do(Cancel, force=True))
|
||||
sp.set('close', lambda: flow.do(Close, force=True))
|
||||
sp.set('skip', lambda: flow.do(Skip, force=True))
|
||||
|
||||
def loads(name: str, b64: str):
|
||||
from base64 import b64decode
|
||||
@@ -428,8 +428,7 @@ def main(driver: Chrome, logger = logging.getLogger('main')):
|
||||
|
||||
while mails := driver.find_elements(By.CSS_SELECTOR, "div.io-ox-mail-compose-window"):
|
||||
try:
|
||||
click(mails[0].find_element(By.CSS_SELECTOR, "button[data-action='close']"), wait=False)
|
||||
click("div.modal-footer button[data-action='delete']", wait=False)
|
||||
click(mails[0].find_element(By.CSS_SELECTOR, "button[data-action='minimize']"), wait=False)
|
||||
except Exception as e:
|
||||
logger.warning('Unable to close off email compose windows', exc_info=e)
|
||||
break
|
||||
@@ -446,29 +445,12 @@ def main(driver: Chrome, logger = logging.getLogger('main')):
|
||||
|
||||
if (target := get_address()) != parameters['account']:
|
||||
error = MismatchedEmailAddress(target)
|
||||
if not options.get('recovery'): raise error
|
||||
|
||||
|
||||
if (target := get_subject()) != subject:
|
||||
error = MismatchedEmailSubject(target)
|
||||
if not options.get('recovery'): raise error
|
||||
|
||||
if error is not None and (c := EC.presence_of_element_located):
|
||||
click("li[data-id='virtual/standard'] > .subfolders li:nth-child(6) .folder-arrow", condition=c)
|
||||
click("li[data-id='virtual/standard'] > .subfolders li:nth-child(6) li.folder:nth-child(1)", condition=c)
|
||||
catch(ready, force=False)
|
||||
click("ul[aria-label='List view'] li[data-index='0']", condition=c)
|
||||
catch(ready, force=False)
|
||||
click("ul.classic-toolbar button[aria-label='More actions']", condition=c)
|
||||
click(".abs + ul.dropdown-menu a[data-action='io.ox/mail/actions/copy']", condition=c)
|
||||
click(".modal-dialog ul.subfolders li[data-id='default0/Brouillons']", condition=c)
|
||||
click(".modal-dialog .modal-footer button[data-action='ok']", condition=c)
|
||||
click("li[data-id='default0/Brouillons']")
|
||||
|
||||
for _ in range(parameters['attempts']):
|
||||
catch(ready, force=False)
|
||||
click("ul[aria-label='List view'] li[data-index='0']", condition=c)
|
||||
if get_subject() == subject: break
|
||||
if not get_subject() == subject: raise error
|
||||
if error is not None and not options.get('force'):
|
||||
raise error
|
||||
|
||||
flow.do(Wait)
|
||||
flow.react()
|
||||
|
||||
BIN
requirements.txt
BIN
requirements.txt
Binary file not shown.
Reference in New Issue
Block a user