from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as ECif __name__ == '__main__':driver.quit()from selenium.webdriver.support.wait import WebDriverWait
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")
Las siguientes son las condiciones esperadas que se pueden utilizar en la espera explícita.
- alertIsPresent()
- elementSelectionStateToBe()
- elementToBeClickable()
- elementToBeSelected()
- frameToBeAvaliableAndSwitchToIt()
- invisibilityOfTheElementLocated()
- invisibilityOfElementWithText()
- presenceOfAllElementsLocatedBy()
- presenceOfElementLocated()
- textToBePresentInElement()
- textToBePresentInElementLocated()
- textToBePresentInElementValue()
- titleIs()
- titleContains()
- visibilityOf()
- visibilityOfAllElements()
- visibilityOfAllElementsLocatedBy()
- visibilityOfElementLocated()