Quantcast
Channel: PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources
Viewing all articles
Browse latest Browse all 6937

How to properly use the Refresh and Refresh2 methods?

$
0
0

I have a loop running that loads 3 different pages using the internet explorer com object.  When the loop comes back around, the first 2 sites refresh but the 3rd won't.  I have tried to use the refresh method with no success.

What I'm not understanding is how do you target something with the refresh method?  I need to use the navigate2 method to load the page but then I can't figure out how to tell it to refresh.  I tried appending the .refresh() to the end of the navigate2 line but that doesn't work. 

My code is below.  How do I force the 3rd page or any for that matter to force a page update?  Also, what is the usage of Refresh2 method and when should I use it over the Refresh method?  The little documentation I found online was not helpful.

Thanks all!

_____________________

 

$ie = New-Object -ComObject InternetExplorer.Application
$ie.visible = $true

$date = Get-Date

While ($date -ge "4/14/11" -and $date -le "7/5/2011")
   
    {
        $ie.Navigate2("http://www.powershell.com")

        Start-Sleep -Seconds 8

        $ie.Navigate2("file://servername/Reports/Main.html")
               
        Start-Sleep -Seconds 8

       
        $ie.Navigate2("file://servername/Reports/Stats.mht")

        $ie.Refresh()

                           
        Start-Sleep -Seconds 10
                   
    }


Viewing all articles
Browse latest Browse all 6937

Trending Articles