How to wait until an element is present in Selenium

Use an explicit wait to only wait as long as necessary for an element to be present.

Java

WebElement element = (new WebDriverWait(driver, 10))
    .until(ExpectedConditions.presenceOfElementLocated(By.id("myID")));

Python


try:
    element = WebDriverWait(driver, 10).until(EC.presence_of_element_located((By.ID, "myID")))
finally:
    driver.quit()

C#

WebDriverWait wait = new WebDriverWait(driver, TimeSpan.FromSeconds(10));
IWebElement element = wait.Until<IWebElement>(d => d.FindElement(By.Id("myID")));