From 9ed494408478dc187e6f30049610ad42c68973b2 Mon Sep 17 00:00:00 2001 From: Alvar Penning Date: Sat, 30 Apr 2022 15:13:04 +0200 Subject: [PATCH] stream.py: attempt to fix presence of chat message In four out of five times, the chat message could not be posted on my setup. This "fix" moves the magic sleep before trying to post the message, as this increases the chance of the overlay to have already disappeared. For further issues, the logging was increased. --- stream.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/stream.py b/stream.py index f196c50..44c5291 100644 --- a/stream.py +++ b/stream.py @@ -166,6 +166,7 @@ def bbb_browser(): browser.get(join_url) + time.sleep(10) try: # Wait for the input element to appear logging.info("Waiting for chat input window to appear.") @@ -193,6 +194,8 @@ def bbb_browser(): element.send_keys(tmp_chatMsg) chat_send.click() + else: + logging.info("chat is not enabled") if args.chat: try: @@ -205,12 +208,12 @@ def bbb_browser(): element.click() except NoSuchElementException: # ignore (chat might be disabled) - logging.info("could not find chat input or chat toggle") - except ElementClickInterceptedException: + logging.warn("could not find chat input or chat toggle") + except ElementClickInterceptedException as e: # ignore (chat might be disabled) - logging.info("could not find chat input or chat toggle") + logging.warn("could not find chat input or chat toggle") + logging.warn(e, exc_info=True) - time.sleep(10) if not args.chat: try: element = browser.find_elements(By.CSS_SELECTOR, 'button[aria-label^="Users and messages toggle"]')[0]