Selenium - espera explícita

from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as EC
if __name__ == '__main__':

driver = webdriver.Chrome()
driver.get("https://www.google.com.ar/maps")

try:
# $x("//*[@id='searchboxinput']")
element = WebDriverWait(driver, 10).until(EC.presence_of_element_located((By.ID, "searchboxinput")))
elem=driver.find_element(By.ID, "searchboxinput")
elem.send_keys("ddddd")

# elemento = driver.find_element(By.ID, "searchboxinput")
elemento = driver.find_element(By.XPATH, "//input[@id='searchboxinput']")
time.sleep(4)




except Exception:
print("nada")
finally:
print("fin")
driver.quit()from selenium.webdriver.support.wait import WebDriverWait


Las siguientes son las condiciones esperadas que se pueden utilizar en la espera explícita.

  1. alertIsPresent()
  2. elementSelectionStateToBe()
  3. elementToBeClickable()
  4. elementToBeSelected()
  5. frameToBeAvaliableAndSwitchToIt()
  6. invisibilityOfTheElementLocated()
  7. invisibilityOfElementWithText()
  8. presenceOfAllElementsLocatedBy()
  9. presenceOfElementLocated()
  10. textToBePresentInElement()
  11. textToBePresentInElementLocated()
  12. textToBePresentInElementValue()
  13. titleIs()
  14. titleContains()
  15. visibilityOf()
  16. visibilityOfAllElements()
  17. visibilityOfAllElementsLocatedBy()
  18. visibilityOfElementLocated()

INDICE