Condicionales esperadas

Clase 15 de 24Curso de Introducción a Selenium con Python

Expected ConditionDescripciónEjemplo
element_to_be_clickable(locator)Espera a que el elemento sea visible y habilitado para hacer clic en el mismoWebDriverWait(self.driver,10).until(expected_conditions.element_to_be_clickable((By.NAME,"accept_button")))
element_to_be_selected(element)Espera a que un elemento sea seleccionadosubscription = self.driver.find_element_by_name("terms"). WebDriverWait(self.driver, 10).until(expected_conditions.element_to_be_selected(terms)))
invisibility_of_element_located(locator)Espera a que un elemento no sea visible o no se encuentre presente en el DOMWebDriverWait(self.driver,10).until(expected_conditions.invisibility_of_element_located((By.ID,"loading_banner")))
presence_of_all_elements_located(locator)Espera a que por lo menos uno de los elementos que se indican coincida con los presentes en el sitioWebDriverWait(self.driver,10).until(expected_conditions.presence_of_all_elements_located((By.CLASS_NAME,"input-text")))
presence_of_element_located(locator)Espera a que un elemento sea visible se encuentre presente en el DOMWebDriverWait(self.driver,10).until(expected_conditions.presence_of_element_located((By.ID,"search-bar")))
text_to_be_present_in_element(locator,text_)Espera a que un elemento con el texto indicado se encuentre presenteWebDriverWait(self.driver,10).until(expected_conditions.text_to_be_present_in_element((By.ID,"seleorder"),"high"))
title_contains(title)Espera a que la página contenga en el título exactamente como es indicadoWebDriverWait(self.driver, 10).until(expected_conditions.title_contains("Welcome"))
title_is(title)Espera a que la página tenga un título idéntico a como es indicadoWebDriverWait(self.driver, 10).until(expected_conditions.title_is("Welcome to Platzi"))
visibility_of(element)Espera a que el elemento indicado esté en el DOM, sea visible, su alto y ancho sean mayores a cerofirst_name = self.driver.find_element_by_id("firstname") WebDriverWait(self.driver, 10).until(expected_conditions.visibility_of(first_name))
visibility_of_element_located(locator)Espera a que el elemento indicado por su selector esté en el DOM, sea visible y que su alto y ancho sean mayores a ceroWebDriverWait(self.driver,10).until(expected_conditions.visibility_of_element_located((By.ID,"firstname")))