I was having the same problem and found an answer!
You can use EC.all_of(*expected_conditions)
to check for multiple Expected Conditions, just like logical AND, or EC.any_of(*expected_conditions)
to check for logical OR.
So the code would be something like this:
WebDriverWait(driver, 5).until(
EC.all_of(
EC.presence_of_element_located((By.ID, "Example")),
EC.visibility_of_element_located((By.ID, "Example"))
)
)
It returns a list of webdriver elements, so if you want to click an element, you'll have to select it by index, adding [i].click()
to the end.
That also means if you want to click a third element outside the ones that you are checking for, you also have to add it to the check, and select it as well. At the end it would be like this:
WebDriverWait(driver, 5).until(
EC.all_of(
EC.presence_of_element_located((By.ID, "Example")),
EC.visibility_of_element_located((By.ID, "Example")),
EC.presence_of_element_located((By.ID, "Clickable"))
)
)[2].click()