Answer the question
In order to leave comments, you need to log in
How to track the completion of all ajax requests on a website page using selenium?
I am learning how to do page UI testing with selenium.
The page has a lot of ajax requests that are executed on load, the problem is that I can't programmatically track when they complete.
I am using this construct:
from selenium import webdriver
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as EC
timeout = 5
wait = WebDriverWait(driver, timeout)
my_tag_present = EC.visibility_of_element_located((By.TAG_NAME, "my_tag"))
wait.until(my_tag_present)
Answer the question
In order to leave comments, you need to log in
Boolean areAjaxRequestsCompleted = driver.execute_script("return (typeof($) === 'undefined') ? true : !$.active;")
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question