How to detect page loading status using applescript and chrome

This is far from rocket science but I haven’t seen it posted so I’m going to put it here for posterity. This is how you can detect if a page is loaded in chrome with applescript. This is a subroutine, so you can put it at the end of your program and call it with this line

checkForLoading()

Ok, here’s the subroutine.

on checkForLoading()
# checks chrome to see if the frontmost tab is loaded
tell application "Google Chrome" to set chromeLoading to loading of active tab of window 1
repeat while chromeLoading = true
delay 1
tell application "Google Chrome" to set chromeLoading to loading of active tab of window 1
end repeat
end checkForLoading

If I recall correctly, wordpress messes up quotes. If this doesn’t compile then replace the quotes and try again.

2 replies on “How to detect page loading status using applescript and chrome”

  1. AFAIK, this does not work. I’ve tried multiple versions… Returns this error:

    Error Number:Google Chrome got an error: Can’t continue checkForLoading.
    -1708

Comments are closed.