Hi! I am fairly new to Eggplant and have inherited some scripts written by my predecessor. When trying to determine if a web page has finished loading, the scripts look for the “Done” text in the bottom left hand corner of the page (for Internet Explorer). This seems to work sometimes but not always. (i.e. sometimes the “Done” text only stays there for a very short time) Is this the “standard” way to check for a web page load completion? Are there others? Any suggestions?
Here are a couple of possibilities:
Use the WaitForAll command to look for several elements on the page. This command will wait until all of the images are present on the screen at the same time. This can be helpful for web pages, where the order in which elements load isn’t predictable. Once they are all visible you may be fairly confident that the page load is complete.
The other idea is to keep your current approach but tighten up Eggplant’s search for the “Done” text so that it won’t miss seeing it. There are a couple of techniques that can help with this. First, set the SearchRectangle to the area where the word “Done” will appear, so Eggplant isn’t spending time searching the rest of the screen. If that isn’t enough, you can temporarily reduce the ImageSearchDelay to reduce the time Eggplant waits between repeated searches:
put the ImageSearchDelay into saveISD
set the ImageSearchDelay to 0.01
waitFor 8, "Done"
set the ImageSearchDelay to saveISD
By setting the SearchRectangle and the ImageSearchDelay like this, you are essentially focusing Eggplant’s attention on watching for that one event. Unless it only flickers very briefly on the screen, this should ensure that Eggplant will see the “Done” when it appears.
Another thought: Most browsers have some sort of animated icon that is replaced when the page loads. You can do a wait until its replacement is displayed or on some browsers you can just look for the “reload” icon to become active. Neither of these is a transient condition, so you won’t have the same problem that you have with the “Done” message.