You may be able to wait for the page to finish loading with:
code:
While $IE.Busy "Waiting for idle..." ?  Loop