Jump to content

Script waits till the page is loaded?

Recommended Posts

ok so i have a script right now that will open up a website and start to type a log in with a password. the problem is, my internet cant keep up with the speed of the script. my solution was to add a sleep() while the page loaded. that worked for most of the time and yet it still didnt work the way i wanted it to. so i saw that there was a pixelchecksum command and i added an If loop that would wait till the checksum was the same as what i set it to. it looks like it works but it still doesnt work 100%

so i was wondering if there was a command that would wait until the webpage is completely loaded and then continue on with the script? can anyone point me in the right direction??

Thx guys!

Link to comment
Share on other sites

That will wait until the window is active.

[font="helvetica, arial, sans-serif"]Hobby graphics artist, using gimp.Automating pc stuff, using AutoIt.Listening to music, using Grooveshark.[/font]Scripts:[spoiler]Simple ScreenshotSaves you alot of trouble when taking a screenshot!Don't remember what happened with this, but aperantly the exe is all i got.If you don't want to run it, simply don't._IsRun UDFIt figures out if the script has ben ran before based on the info in a ini file.If you don't want to use exactly what i wrote, you can use it as inspiration.[/spoiler]

Link to comment
Share on other sites

From the help file:

Wait for a browser page load to complete before returning.

#include <IE.au3>

_IELoadWait ( ByRef $o_object [, $i_delay = 0 [, $i_timeout = -1]] )


$o_object Object variable of an InternetExplorer.Application or DOM element

$i_delay [optional] Milliseconds to wait before checking status

$i_timeout [optional] Period of time to wait before exiting function (default = 300000 ms aka 5 min)

Return Value

Success: Returns 1

Failure: Returns 0 and sets @ERROR

@Error: 0 ($_IEStatus_Success) = No Error

1 ($_IEStatus_GeneralError) = General Error

3 ($_IEStatus_InvalidDataType) = Invalid Data Type

4 ($_IEStatus_InvalidObjectType) = Invalid Object Type

6 ($_IEStatus_LoadWaitTimeout) = Load Wait Timeout

8 ($_IEStatus_AccessIsDenied) = Access Is Denied

9 ($_IEStatus_ClientDisconnected) = Client Disconnected

@Extended: Contains invalid parameter number


Several IE.au3 functions call _IELoadWait() automatically (e.g. _IECreate(), _IENavigate() etc.). Most functions that do this also allow you to turn this off with a $f_wait parameter if you do not want the wait or if you want to call it yourself.

When document objects or DOM elements are passed to _IELoadWait, it will check the readyState of the container elements up to and including the parentwindow.

Browser scripting security restrictions may sometimes prevent _IELoadWait from guaranteeing that a page is fully loaded and can occasionally result in untrapped errors. In these cases you may need to avoid calling _IELoadWait and attempt to employ other methods of insuring that the page load has completed. These methods might include using a Sleep command, examining browser status bar text and other methods. When using functions that call _IELoadWait for objects other than the InternetExplorer (browser) object, you may also be successful by calling _IELoadWait for the browser yourself (e.g. _IELoadWait($oIE)).

The most common causes of trouble are page redirects and cross-site scripting security restrictions associated with frames. Page re-writing techniques employed by some applications (e.g. Gmail) can also cause trouble here.


_IELoadWaitTimeout, _IECreate, _IENavigate, _IEFormSubmit, _IELinkClickByText, _IELinkClickByIndex, _IEImgClick, _IEFormImageClick, _IEBodyWriteHTML, _IEDocWriteHTML, _IEAction


; *******************************************************
; Example 1 - Open the AutoIt forum page, tab to the "View new posts"
;               link and activate the link with the enter key.
;               Then wait for the page load to complete before moving on.
; *******************************************************
#include <IE.au3>
$oIE = _IECreate ("http://www.autoitscript.com/forum/index.php")
Send("{TAB 12}")
_IELoadWait ($oIE)

Edited by Blue_Drache

Lofting the cyberwinds on teknoleather wings, I am...The Blue Drache

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

  • Recently Browsing   0 members

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