Wait until the page loaded Selenium Python

  • I'm opening a chrome tab with Selenium Python. I want to wait until the blue circle stops revolving. Please check the screenshot. use case is to clock on login button and a pop up comes. If page is still loading i.e. the blue circle is still revolving then login button does not work. I want to wait until that blue circle disappears.

  • This should help u:

    from selenium.webdriver.support.ui import WebDriverWait
    from selenium.webdriver.support import expected_conditions as EC
    from selenium.webdriver.common.by import By
    login_btn = WebDriverWait(driver, 500).until(EC.presence_of_element_located((By.XPATH, 'xpath of login button'))) #Waits until the login button is visible.

    If u don't wanna find the button by its xpath, then u can change By.XPATH to By.ID or By.CLASS_NAME.

Suggested Topics