Jump to content
Macro Express Forums

Wait for Text to appear on Web page


Recommended Posts

Hello All,


This is my first topic on this site after going through as much as possible and I have to say there is a quite a lot of very useful information. Thank you for that.


For starters, I am fairly familiar with ME and have created some macros that help in our work. One thing that I seem to be having trouble with is the issue of delays. We have a web based portal that basically switches pages based on clicks of radio buttons as well as regular buttons. As a headsup, the Window Title AND Web URL DO NOT change at all no matter what screen you are on. Going further, I currently have it set up to delay a certain amount of time per each section. Yes, it does work, but as we all know, computer and internet speed can flucuate and sometimes cause problems. In addition, I would greatly prefer to optimize the Macro to its greatest speed and efficiency.


My question to you all is, is there any way to set a sort of "Wait/Delay" to recognize if certain text has appeared on the web page. For example, the first section of our portal is "AREA SELECTION". Once the Macro fills out all the necessary information, a button is clicked and the next page is "RATEPLAN SELECTION". I would like for the macro to be able to wait/delay until it the text "RATEPLAN SELECTION" exists on the page. Like I said, I currently have it setup to where it is just waiting a set amount of time. As a reminder, the Window Titles or URL do not change at all throughout the entire process which is my main issue. Does anyone have any recommendations?


Thank you in advance,



Link to comment
Share on other sites

You could experiment with the Wait for Web Page command, which is intended to tell you when IE is no longer busy (that is, next page has been completely loaded).


Another method would be to pick a pixel location that you know will change color when the subsequent web page appears, and monitor for the change with a REPEAT loop that checks current color. That might or might not be sufficient, since the spot on the screen could change before the next page has finished loading.


Or, try having the macro type Ctrl-f (again in a REPEAT loop) to find and highlight "RATEPLAN SELECTION", followed by ESC to clear the Find box, followed by copy-to-clipboard, then examine the clipboard contents for the text. If it's there in the clipboard then your next page has at least partially loaded. Might be best to follow detecting the text with Wait for Web Page. This method is kind of ugly since the Find box will appear on the screen. Make sure to clear clipboard content so you don't "find" text left over from last time the macro ran.


If you're lucky, someone will post a cleaner and simpler and more reliable method that I haven't thought of.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...