Sign in to follow this  
Followers 0
hallaplay835

Ensuring webs are fully loaded

5 posts in this topic

Hello I am new to AutoIt scrpiting, I just know the basics.

I am aware that the ShellExecute() function will open up the default web browser and load the page specified inside the function. However, I am concerned about how much time the web page takes to load.

Let me explain myself. Due to slow internet connections or old hardware, in some computers the page will take more time to load.

I have opened this topic to discuss ways to ensure that the script will not continue executing until a web page has been fully loaded, and when I mean fully I mean FULLY (i.e. javascript codes, flash files, mash-ups, etc... - all of the web page's content).

I suppose one way to achieve this could be by using the WinWaitActive() function, but according to the documentation, this will pause the execution of the script until a window pops up with a specified title. However, when web pages are rendered by browsers they begin by displaying the page title in the title bar and only then they start loading the contents of the page (i.e. the <body></body> tag). The script would resume but the web page is still not fully loaded.

Another way to achieve this could be by using the StatusBarGetText() function, which retrieves the text from a standard status bar control. Using a While / Wend loop I suppose you could pause the script until the status bar matches the word "Ready". However, this would not work in all browsers as not all of them have a status bar (e.g. Google Chrome), and the text tisplayed in the status bar is different depending on the language or on the web browser version.

Maybe there is a function or a combination of UDFs put together that could solve this problem, but I have scanned the documentation and I can not come up with a solution. Please comment on how could you ensure that a page has been fully loaded before resuming the execution of the script. Thanks in advance.


_____________________________________________________[size="2"][font="Arial"]"Pain is temporary, glory is forever."[/font][/size]

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

If you're using IE, _IELoadWait() and some of the other IE functions have the wait built-in, that should do it for you. If you're using whatever the user's default browser is, then I guess it's a little more complicated lol. Check IE.udf

Add: and Welcome! :)

Edited by MrMitchell

Share this post


Link to post
Share on other sites

If you're using IE, _IELoadWait() and some of the other IE functions have the wait built-in, that should do it for you. If you're using whatever the user's default browser is, then I guess it's a little more complicated lol. Check IE.udf

Add: and Welcome! :)

Thanks for your help MrMitchell, I did not know about this function. Nonetheless, I am looking for something that will work in all web browsers, not only IE.


_____________________________________________________[size="2"][font="Arial"]"Pain is temporary, glory is forever."[/font][/size]

Share this post


Link to post
Share on other sites

Well then I suppose you'd want to take on each browser one at a time and figure out which browser the client has at the beginning of the script. There are UDFs for IE and FireFox that I know of in these forums, not sure about other browsers though...

May I ask if you're going to interact with the browser window at all after loading it? And if so, what would you need to do with it?

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

Well then I suppose you'd want to take on each browser one at a time and figure out which browser the client has at the beginning of the script. There are UDFs for IE and FireFox that I know of in these forums, not sure about other browsers though...

May I ask if you're going to interact with the browser window at all after loading it? And if so, what would you need to do with it?

Thanks for this information. Could you provide me with some links to these UDFs you are talking about? I am pretty new to the forum, and I do not know how to get around very much.

Once the page is fully loaded, I want to retrieve information (mainly numbers) displayed on the page (I assume the only way to find out what is on a page is by examining the source HTML markup - correct me if I am wrong - ), and to interact with it (I have no problem with this as in all major browswers by pressing TAB you can skip over all of the controls and hyperlinks on a web page).

If you know other methods of retrieving information displayed on a web page or interacting with it please tell me, you are being of great help. Thanks again.

Edited by hallaplay835

_____________________________________________________[size="2"][font="Arial"]"Pain is temporary, glory is forever."[/font][/size]

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