I need to wait for a website to finish loading some AJAX (it's a jstree that takes a few seconds to load). Not sure if this is the correct terminology as it's not something I'm really familiar with. IE is showing not busy before the AJAX in the page finishes loading.
In python/selenium, the following code (which I got from StackOverflow) works for what I'm trying to do:
Code: Select all
def wait_for_ajax(driver):
wait = WebDriverWait(driver, 15)
try:
wait.until(
lambda driver: driver.execute_script("return jQuery.active") == 0
)
wait.until(
lambda driver: driver.execute_script("return document.readyState")
== "complete"
)
except TimeoutException as e:
logger.error(str(e))