Sign in to follow this  
Followers 0
brokensword02

Wait for page to completely load

4 posts in this topic

#1 ·  Posted (edited)

Hello everybody , i'm trying a scrip in autoit to do something in firefox a lot of times. My problem is that sometimes , the page takes more time to load and then the movement of the mouse might be late or sooner than the loading. Is there any way to tell him to execute the action just after the page finishes loading ? Thanks !

Edited by brokensword02

Share this post


Link to post
Share on other sites



don't know about firefox, but in IE there is a function that does that, IELoadWait or something, so I imagine they must have one for FF, look in the help file for it


<It Shall Be Done>

Share this post


Link to post
Share on other sites

Yeah I checked , but it only works the first time you launch IE with Run("...\IE.exe) Then it's gonna wait the page to load to continue the script. But i would want something to make a pause between two actions and tell the next one to wait for the page to load. Not just at the beginning.

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Try using the IE functions. You can create your own instance of IE, hidden or shown, as well as attach to existing instances of IE. Then just navigate to the page you want to wait for with the IE functions, and put something like _IEPropertyGet($oIE, "busy") in a loop until it is no longer working on loading the page.

EDIT:

The IE function _IENavigate has a built in option for waiting for the page to load. So you have many options. Here are a few that would work:

#include <IE.au3>
_IEErrorHandlerRegister()

$oIE = _IECreate("about:blank")
_IENavigate($oIE, "http://www.autoitscript.com/forum/index.php"); (Default) Wait for page load to complete before returning
MsgBox(0, 'Done', 'Done loading page')
_IEQuit($oIE)

;OR WITH IE PROPERTY

$oIE = _IECreate("about:blank")
_IENavigate($oIE, "http://www.autoitscript.com/forum/index.php", 0) ;Return immediately, not waiting for page to load
While _IEPropertyGet($oIE, "busy") = True
    Sleep(50); wait while IE is busy
WEnd
MsgBox(0, 'Done', 'Done loading page' & @CRLF & "-Open your own instance of IE for the next method.")
_IEQuit($oIE)

;OR WITH ATTACH

$oIE = _IEAttach('', 'Instance')
If @error Then
    MsgBox(0, 'Error', 'No instance of IE to attach to.')
Else
    _IENavigate($oIE, "http://www.autoitscript.com/forum/index.php") ;Default) Wait for page load to complete before returning
    MsgBox(0, 'Done', 'Done loading page')
    _IEQuit($oIE)
EndIf
Edited by danwilli

Share this post


Link to post
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
Sign in to follow this  
Followers 0