diff --git a/main.py b/main.py index b451943..34664eb 100644 --- a/main.py +++ b/main.py @@ -496,7 +496,9 @@ def main(driver: WebDriver, logger = logging.getLogger('main')): while not flow.react(Wait, Sleep): try: + span = locate(".mm-tbody table tbody tr:nth-child(1) td:nth-child(3) span:nth-child(1)", wait=False) err = locate(".mm-tbody table tbody tr:nth-child(1) td:nth-child(5) .okki-space-item:nth-child(1) button", wait=False) + ok = locate(".mm-tbody table tbody tr:nth-child(1) td:nth-child(3) a", wait=False) if span.get_attribute('title') else None break except: pass try: click(".product-import-img-footer button.mm-button__primary", wait=False) @@ -509,8 +511,11 @@ def main(driver: WebDriver, logger = logging.getLogger('main')): logger.warning('Incomplete import detected; downloading 1 related document') flow.react(Sleep) - try: click(".mm-tbody table tbody tr:nth-child(1) td:nth-child(3) a") - except: continue + if ok is None: + logger.warning('Nothing to do; skipping') + continue + + click(ok, condition=None) flow.react(Sleep) class Parse: