How to track the completion of all ajax requests on the page using selenium?

Learn to make UI testing a page with selenium.
On the page there are a lot of ajax requests that are executed at boot, the problem is that I can't programmatically keep track of when their execution is complete.

Use the following structure:

from selenium import webdriver
from import WebDriverWait
from import By
from import expected_conditions as EC

timeout = 5
wait = WebDriverWait(driver, timeout)
my_tag_present = EC.visibility_of_element_located((By.TAG_NAME, "my_tag"))

this approach works, but not always, and I have to specify a specific tag (tag_id, class, xpath).

I want to apply a more integrated and universal approach, without specifying the right tags.
As, for example, work services for testing sites. He (the service) because it is unknown which items should be on the page, however, the total time of download and a screenshot of the loaded page in the report we see.
June 27th 19 at 14:54
2 answers
June 27th 19 at 14:56
driver.execute_script("return == 0") - marilyne_Roh commented on June 27th 19 at 14:59
What and how to wrap everyone decides you - winnifred_Luettge commented on June 27th 19 at 15:02
June 27th 19 at 14:58
Boolean areAjaxRequestsCompleted = driver.execute_script("return (typeof($) === 'undefined') ? true : !$.active;")

Find more questions by tags SeleniumPythonTesting software