Sign in to follow this  
Followers 0
bmihura

How do I wait for browser items to appear?

8 posts in this topic

How do I get AutoIt to wait for items in a browser (on a web page) to show up, like buttons or text boxes or hyperlinks?

WinWaitActive is nice for operating system windows, but does AutoIt have functions for handling items within web pages?

If not, is there something other than AutoIt for web pages?

Share this post


Link to post
Share on other sites



How do I get AutoIt to wait for items in a browser (on a web page) to show up, like buttons or text boxes or hyperlinks?

WinWaitActive is nice for operating system windows, but does AutoIt have functions for handling items within web pages?

If not, is there something other than AutoIt for web pages?

<{POST_SNAPBACK}>

I usually stick with the basics when writing scripts--especially simple scripts. What I usually do when waiting for a page to load is to do a PixelGetColor on the Stop Loading This Page icon on the top of the Mozilla browser to see if the pixel color is no longer red (meaning the page is finished loading.)

On IE, you can just do a StatusBarGetText ("Title", "Text", 1) and look for the word Done to see if the page has finished loading.

Once the page is fully loading, you can be pretty sure the buttons/hyperlinks have loaded as well.

Share this post


Link to post
Share on other sites

The StatusBarGetText method is simple and is a good solution.

If your interaction needs with IE are more complex however, have a look at the IE Automation UDF Library. The code below will create a browser window, navigate to a page and wait for the page to finish loading before returning control to you:

#include <IE.au3>
$oIE = _IECreate()
_IENavigate("www.autoitscript.com")

Dale


Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Share this post


Link to post
Share on other sites

I have a similar issue, but am working with Google Chrome and need to have the script wait until the page is completely loaded. In some cases the page title changes and the WinWaitActive handles these pages just fine, but I have others that the title never changes and there seems to be no way to have the script wait until the pages have completely loaded. How can I accomplish this?

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

Allow me to upgrade this question. Since there is no Chrome UDF, I may have to start using IE for this particular project. However, I am working with one website that has CAPTCHA during the login and therefore would require that site to be open and logged in prior to script execution and in reading the documentation, I don't see how to work with pages that are already loaded. _IECreate and IENavigate would not work well in that scenario. The other site works fine with those 2 functions and won't be an issue. Can someone clue me in on how to work with IE windows that are already open?

Edited by Daymond

Share this post


Link to post
Share on other sites

I have probably answered my own question to some degree, as I can use the WinActivate syntax to bring the IE window forward, but when I have the script follow a link, I need to have it wait until the page fully loads before it proceeds to the next line. Am I looking for an object to be present or is there another way to go about this? Sorry, but even though I have used AutoIt for a number of years, I have never worked with it to this degree.

Share this post


Link to post
Share on other sites

Is it really impossible to determine when a web page has finished loading in Chrome?

I tried WinWaitActive() and passed a text parameter of "help" because the page I need to load has the word help at the bottom, but the script never reaches past that point.

...
Send("https://support.twitter.com/forms/general{ENTER}")
Sleep(1000)
WinWaitActive("Twitter Help Center - Google Chrome","help")
; never here

Share this post


Link to post
Share on other sites

If not, is there something other than AutoIt for web pages?

Maybe you can do something with this, the REBOL Language.

- Bruce /*somdcomputerguy */  If you change the way you look at things, the things you look at change.

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