Itβs good practice to βwaitβ for a unique element to appear (for a new page).
You can use the expected_conditions module.
For example, you can wait for the user logo to be entered:
from selenium import webdriver from selenium.common.exceptions import TimeoutException from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.support import expected_conditions as EC from selenium.webdriver.common.by import By driver = webdriver.Firefox() driver.get('http://yourapp.url') timeout = 5 try: logo_present = EC.presence_of_element_located((By.ID, 'logo_id')) WebDriverWait(driver, timeout).until(logo_present) except TimeoutException: print "Timed out waiting for page to load"
Max v source share