Skip to content

Commit

Permalink
stream.py: attempt to fix presence of chat message
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
oxzi committed May 11, 2022
1 parent da029bb commit 9ed4944
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions stream.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.")
Expand Down Expand Up @@ -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:
Expand All @@ -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]
Expand Down

0 comments on commit 9ed4944

Please sign in to comment.