Assuming that I have 3 different scenarios in those different scenarios different elements are shown.
How can I use WebDriverWait for multiple elements and if one of those elements are found ignore the finding of other elements.
I had tried WebDriverWait to sleep for x number of seconds then do an if statement with driver.find_element_by_id and find if the elements are present but this is highly inefficient because the page can take longer/less to load, you can see what I tried in the following code:
WebDriverWait(driver, 30)
if len(driver.find_elements_by_id('something1')) > 0:
*do something*
elif len(driver.find_element_by_id('something2')) > 0:
*do something*
elif len(driver.find_element_by_id('something3')) > 0:
*do something*
I also tried WebDriverWait(driver, 60).until(EC.visibility_of_element_located((By.ID, 'something'))) with a try and except but this is the most inefficient method as it because it takes much more longer longer.
breakstatement under each*do something*? Actually it doesn't need to be in order of importance if all you care about is if ANY element is found. Either way though, I thinkbreakshould work for this use casefind element byto include the wait method wrapped around it. You already have theWebDriverWait(driver, 30)initiated above theifblock, just change how you are finding the elements below it to incorporate it. Also, not sure how the "different code based on the element found" matters, the break is going beneath that, in each if/else statement