I'm currently writing a script and I'm using
while($IE.busy) {Start-Sleep 1}
to wait for the page to be ready.
Once the page is ready my script fills out and submits a form. I've been running into problems because (I think) IE reports that it's done when the page is loaded but before the document has been rendered (which causes the script to error out). My current workaround is to add a 4 second wait time after the page loads but I'd feel more comfortable with a method that isn't time based if possible.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…