IE com, wait for AJAX to finish loading

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
ffalcon31415
Posts: 1
Joined: 11 Apr 2023, 09:51

IE com, wait for AJAX to finish loading

11 Apr 2023, 09:59

I'm using IE com to do website automation (fingers crossed for my employer not removing IE anytime soon).

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))
I can't figure out how to implement this in AHK (v1.1). I can't even figure out how to execute some javascript using the IE com. Any assistance would be appreciated.

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: mstrauss2021, robozao and 246 guests