how to tell selenium to wait for loading a page code example
Example 1: selenium java wait for page load
WebDriverWait wait = new WebDriverWait(driver, 20);
wait.until(ExpectedConditions.elementToBeClickable(lastElementToLoad));
Example 2: wait until page loads selenium javascript
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
driver=webdriver.Firefox()
driver.get("http://www.example.com") #This is a dummy website URl
try:
elem=WebDriverWait(driver,10).until(
EC.presence_of_element_located((By.ID,"Element_to_be_found")) #This is a dummy element</span>
)
finally:
driver.quit()