Jump to content

Wait until webpage loads


 Share

Recommended Posts

I have a loop to attach to a webpage, do stuff, then click next.

Obviously it takes time for a page to load so I'm trying to use IELoadWait but that doesn't seem to work.

I also tried to read the statustext but that doesn't work either.

Here is a snippet of the code I have:

While $j > 0
WinActivate("Home Page - Microsoft Internet Explorer")
$hWnd = WinGetHandle("Home Page - Microsoft Internet Explorer")
$oIE = _IEAttach($hWnd, "hwnd")
Local $sStatus
While Not ($sStatus = "Done")
    $sStatus = _IEPropertyGet ( $oIE, "statustext")
    Sleep(1900)
WEnd
Link to comment
Share on other sites

Does this work for you?

#include <IE.au3>

_IEErrorHandlerRegister()

AutoItSetOption("MustDeclareVars", 1)

Dim $urls[3]
$urls[0] = "http://google.com/"
$urls[1] = "http://yahoo.com/"
$urls[2] = "http://bing.com/"

WinActivate("Blank Page - Windows Internet Explorer")
dIM $h = WinGetHandle("[ACTIVE]")
Dim $oIE = _IEAttach($h, "hwnd")

If @error > 0 Then
    MsgBox(0, "ERROR", @error)
    Exit
EndIf

For $x = 0 to 2
    _IENavigate($oIE, $urls[$x])
    _IELoadWait($oIE)
    MsgBox(0, "", "Finished loading:" & @CRLF & $urls[$x])
Next

Sleep(250)
_IENavigate($oIE, "about:blank")
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...