Jump to content
Macro Express Forums

"Wait for Web Page"


Recommended Posts

I have a page which I believe is Java, and when I manipulate it I need to wait several seconds for a frame to finish reloading before I can manipulate it again.

 

I activate the window, then use "Wait for Web Page":

With the URL blank, the macro does not continue until the wait times out.

 

If I specify the URL it does not pause at all because the main page itself is always loaded.

 

Specifying the exact URL of the frame itself also does not work.

 

Ideas?

 

This is IE 8.

 

Thanks,

 

-Travis

Link to comment
Share on other sites

I have a page which I believe is Java, and when I manipulate it I need to wait several seconds for a frame to finish reloading before I can manipulate it again.

 

I activate the window, then use "Wait for Web Page":

With the URL blank, the macro does not continue until the wait times out.

 

If I specify the URL it does not pause at all because the main page itself is always loaded.

 

Specifying the exact URL of the frame itself also does not work.

 

Ideas?

 

This is IE 8.

 

Thanks,

 

-Travis

 

"Wait For"s can sometimes be a little tricky. If you are finding that the actual Wait For command is not working to your satisfaction, you can try a short Repeat Loop like this:

 

Repeat Until %N1% = 16777215
 Get Pixel: Window Coords: 439,447 into %N1%
Repeat End

 

In this example I'm causing Macro Express to check the pixel at 439,447 over and over until that pixel is white.

 

The Get Pixel command window has a Mouse Locator tool that can tell you what the color under a given pixel is (such as 16777215, which is 'white').

 

So the trick is to try and figure out what changes about the page you are waiting for when it finishes loading. This, too, may not work 100% of the time. From what I understand (which may not be much) some Java windows appear to be done loading when in reality they are still hanging somehow.

 

But it's at least another option to play with.

Link to comment
Share on other sites

"Wait For"s can sometimes be a little tricky. If you are finding that the actual Wait For command is not working to your satisfaction, you can try a short Repeat Loop like this:

 

Repeat Until %N1% = 16777215
 Get Pixel: Window Coords: 439,447 into %N1%
Repeat End

 

In this example I'm causing Macro Express to check the pixel at 439,447 over and over until that pixel is white.

 

The Get Pixel command window has a Mouse Locator tool that can tell you what the color under a given pixel is (such as 16777215, which is 'white').

 

So the trick is to try and figure out what changes about the page you are waiting for when it finishes loading. This, too, may not work 100% of the time. From what I understand (which may not be much) some Java windows appear to be done loading when in reality they are still hanging somehow.

 

But it's at least another option to play with.

 

 

I'll give that a shot. Worst case scenario is that I'll have to set a simple delay that will outlast even the longest lag in the frame. It will slow down the overall job, but I only have to do this three times a year and it will still only take a few hours, tops.

Link to comment
Share on other sites

"Wait For"s can sometimes be a little tricky.

The Wait for Web Page relies on a 'Busy' flag inside Internet Explorer. Depending on the website the flag goes busy and not busy multiple times. For example, on a page with multiple ads the busy flag can go busy/not busy for the main page and for each of the ads.

 

In the case of a Java application, the flag goes not busy as soon as the page is loaded but the java program can still be running. IE says something like "I loaded everything" but it doesn't say "everything I loaded has finished running."

 

As Scasper suggests, if you can identify something that changes color on the screen you could use the Get Pixel to determine when the process is complete. However, sometimes the Get Pixel can be tedious. You have to check for an exact color and the color of one pixel can differ slightly from the pixel next to it. And theme changes change the colors. If it was me, for a process that only runs three times a year, I wouldn't bother with optimizing the timing.

Link to comment
Share on other sites

Another caveat. I use Firefox and sometimes need to do a "quick search" for some text on the page. I always wait for a Firefox page to finish loading (by checking that the X colour is no longer red) before doing my quick search (in my case by typing |xyz if I want to look for xyz). But I've found for some pages that I must wait 1800 milliseconds after the page has completely finished loading before the quick search works properly. The curious thing is that the initial "|" causes the quick search box to appear even when there's no delay, but the cursor doesn't start blinking (and therefore won't accept any input) until that 1800 milliseconds has passed. Now, sigh, if only there were a way to detect whether the text cursor is blinking or not....

Link to comment
Share on other sites

I have been programming for more years than I care to admit. With pre-Microsoft systems, you could generally go to a manual, read up on how something worked, then write your code based on the documentation. Bill Gates turned that on its head. Now the documentation is either non-existent or moot. You have to do trial-and-error to see how the system works, then write your code, then wait for it to break because of something you didn't see first time around, modify your code, then start all over with the next release of Windows or IE. Idiosyncrasies handled easily by the human brain are difficult to code for, but that's exactly what we wind up doing with ME.

 

Philosopher Bob

Link to comment
Share on other sites

I have been programming for more years than I care to admit.

Me too!

You describe the Microsoft world very well. But I wouldn't blame ME for the iniquites foisted on us by MS and its idiosyncrasies. I suppose I should be grateful that MS allows me to run Firefox at all! Perhaps they weren't clever enough to pass an electric current through my keyboard! :rolleyes:

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.

Guest
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.

Loading...
×
×
  • Create New...