Can powershell wait until IE is DOM ready?

Question:

I’m currently writing a script and I’m using

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.

Answer:

Here’s how I do this.

Step 1 – Identify a web page element that only appears once the page is fully rendered. I did this using the Chrome developer tools ‘Elements’ view which shows the DOM view.

Step 2 – Establish a wait loop in the script which polls for the existence of the element or the value of text inside that element.

Source:

Can powershell wait until IE is DOM ready? by licensed under CC BY-SA | With most appropriate answer!

Leave a Reply