I'm using Selenium 2 / WebDriver with the Python API, as follows:
from selenium.webdriver.support import expected_conditions as EC
# code that causes an ajax query to be run
WebDriverWait(driver, 10).until( EC.presence_of_element_located(
(By.CSS_SELECTOR, "div.some_result")));
I want to wait for either a result to be returned (div.some_result
) or a "Not found" string. Is that possible? Kind of:
WebDriverWait(driver, 10).until(
EC.presence_of_element_located(
(By.CSS_SELECTOR, "div.some_result"))
or
EC.presence_of_element_located(
(By.CSS_SELECTOR, "div.no_result"))
);
I realise I could do this with a CSS selector (div.no_result, div.some_result
), but is there a way to do it using the Selenium expected conditions method?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…