Reputation: 2206
I want to ask about manipulating IE via Powershell. My goal is to write script that will automatically perform some actions in the browser (on the client side – navigate to page, perform actions, measure time between responses, etc.)
I have this little thing:
$ie = new-object -com "InternetExplorer.Application"
$ie.visible = $true
$ie.navigate("http://google.com")
Now I want to check whether the browser stopped page rendering (assuming, that google takes like 30 seconds to load).
As I checked with $ie | get-member
there is DocumentCompleted property (event), but I don’t know how to access/compare it.
How should I do that?
Or maybe I should use .NET instead COM object and initiate $ie
with [system.Windows.Forms.WebBrowser]
?
cheers
edit:
Well... $ie.busy
works, but (what maybe I haven't made clear earlier) I want to know exact moment of the page rendering competition. Checking $ie.busy
in infinite loop every second might work but I suppose it's not the best way to do that.
Let's say page is loading some time (rendering is long due to the gigantic scripts on client side). I would like how long does it take to:
Upvotes: 2
Views: 6723
Reputation: 15011
Since it has an event, you could try out the PowerShell Eventing Library. It says that it supports COM events, though I haven't tried it.
Upvotes: 0
Reputation: 570
You can check .busy property.
edit:
Status property will also work here. However you can use tool like Firebug to see page load time.
Upvotes: 1