update: bump 'common' version to 0.1.21
This commit is contained in:
@@ -145,14 +145,6 @@ def main(driver: Chrome, logger = logging.getLogger('main')):
|
|||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def ready(driver: Chrome):
|
|
||||||
busy = driver.find_element(By.CSS_SELECTOR, ".io-ox-busy")
|
|
||||||
return busy
|
|
||||||
|
|
||||||
def catch(predicate: Callable[[Chrome], WebElement]):
|
|
||||||
wait = WebDriverWait(driver, timeout=parameters['interval'])
|
|
||||||
return wait.until(predicate, 'Timeout')
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
driver.switch_to.new_window('tab')
|
driver.switch_to.new_window('tab')
|
||||||
driver.set_page_load_timeout(parameters['timeout'])
|
driver.set_page_load_timeout(parameters['timeout'])
|
||||||
@@ -224,6 +216,12 @@ def main(driver: Chrome, logger = logging.getLogger('main')):
|
|||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def perform(cls):
|
def perform(cls):
|
||||||
|
try: busy = driver.find_elements(By.CSS_SELECTOR, ".io-ox-busy")
|
||||||
|
except: busy = None
|
||||||
|
|
||||||
|
if busy:
|
||||||
|
sleep(parameters['interval'])
|
||||||
|
return True
|
||||||
if status == Status.RUNNING:
|
if status == Status.RUNNING:
|
||||||
timer.start()
|
timer.start()
|
||||||
return False
|
return False
|
||||||
@@ -455,7 +453,7 @@ def main(driver: Chrome, logger = logging.getLogger('main')):
|
|||||||
|
|
||||||
flow.react(Wait)
|
flow.react(Wait)
|
||||||
click("ul.classic-toolbar button[aria-label='Edit copy']")
|
click("ul.classic-toolbar button[aria-label='Edit copy']")
|
||||||
until(ready)
|
flow.react(Wait)
|
||||||
locate("div.io-ox-mail-compose-window iframe", condition=EC.frame_to_be_available_and_switch_to_it)
|
locate("div.io-ox-mail-compose-window iframe", condition=EC.frame_to_be_available_and_switch_to_it)
|
||||||
|
|
||||||
if options.get('greet') and not (clean := False):
|
if options.get('greet') and not (clean := False):
|
||||||
@@ -535,7 +533,7 @@ def main(driver: Chrome, logger = logging.getLogger('main')):
|
|||||||
continue
|
continue
|
||||||
|
|
||||||
try:
|
try:
|
||||||
alert = catch(lambda x: x.find_element(By.CSS_SELECTOR, "div.io-ox-alert.io-ox-alert-error"))
|
alert = until(lambda x: x.find_element(By.CSS_SELECTOR, "div.io-ox-alert.io-ox-alert-error"), timeout=parameters['interval'])
|
||||||
message = alert.text.replace('\n', ' ')
|
message = alert.text.replace('\n', ' ')
|
||||||
click("div.io-ox-alert.io-ox-alert-error button[data-action='close']")
|
click("div.io-ox-alert.io-ox-alert-error button[data-action='close']")
|
||||||
logger.warning('Error while sending email (message: %s); retrying (%d)...', message, attempts)
|
logger.warning('Error while sending email (message: %s); retrying (%d)...', message, attempts)
|
||||||
|
|||||||
Binary file not shown.
Reference in New Issue
Block a user