I am looking for a better way to write a multiple condition try-except statement,
Actually I check for some condition "A" and if it fails, well I look for "B",
In this case I am trying 2 different scenarios for selenium webdriver. Sometimes I try more than 2 options
try:
message_button = WebDriverWait(self.driver, 20).until(
EC.element_to_be_clickable((By.XPATH, '//button/div[contains(text(), "Anybody")]')))
return False
except Exception as e:
try:
message_button = WebDriverWait(self.driver, 20).until(
EC.element_to_be_clickable((By.XPATH, '//span/div[contains(text(), "Somebody")]')))
return False
except Exception as e:
return "yes"
Also a way to look for both a at a time would be nice!