NEW Version 2.0: Game Mode and Heliot, your AI assistant, are here Discover it

How to make a macro wait for a page to load, without fixed pauses

Fixed pauses make your macros slow or fragile. How to wait for an element to appear instead of a fixed time, and how to do it in Macro Quantic Pro.

6 min read

A web portal generating a report while Macro Quantic Pro sets up an OCR robot to wait for it to finish.

Your macro works when the website is fast and fails when it's slow. Or the other way around: you added long pauses so it wouldn't fail, and now it takes forever. Making a macro wait for the page to load without relying on fixed pauses is the difference between fragile automation and reliable automation. In this article you'll see why fixed pauses cause problems, what the alternative is and how to apply it today in Macro Quantic Pro.

The problem with fixed pauses

A fixed pause tells the macro: "wait 3 seconds and continue". The problem is that the website doesn't always take the same amount of time.

  • If the pause is short, the macro clicks before the page has finished loading. The click lands on an empty gap or on another element, and everything after that fails.
  • If the pause is long, the macro hits the target, but it wastes time on every repetition. And that time adds up.

On the Keyboard Maestro forum, a user described exactly this dilemma. They had to go through more than 10 web pages: with half a second of waiting the macro failed, and with waits of a second or more the whole process became too slow, especially when each page needed several clicks and several waits.

The idea: wait for a condition, not for a time

The alternative is to change the question. Instead of "how long do I wait?", the macro should ask "is what I need there yet?".

Waiting for a condition means the macro doesn't continue until something specific exists on the screen:

  • A button, such as "Download" or "Next".
  • A form field.
  • A text, such as "Report ready" or "Payment complete".

If the page loads in half a second, the macro continues after half a second. If it takes ten, it waits ten. That's what the forum mentioned above recommended: wait for a specific element of the page to exist instead of using arbitrary delays.

How to do it in Macro Quantic Pro

It's worth being clear from the start. Macro Quantic Pro is preparing a Web mode with a built-in browser, which will find each field by what it is and wait for the page to load. Today, that mode appears in the program as Coming soon: it isn't available yet.

In the meantime, there are two tools you can already use so your macro waits for what matters.

1. Smart mode, for buttons that take a moment

Smart mode saves a small picture of what you click while recording. During playback, if the button isn't where it should be yet, it looks for it again for a brief moment before clicking.

It's useful for small delays: a drop-down that takes a moment to open, a list that fills in after you type or a button that appears an instant later. For waits of several seconds it isn't enough, because it only retries for a short moment. Smart mode is available in the free trial and on the Starter, Pro and Enterprise plans; not on Free.

One of the cases Smart mode covers: if the button takes a while to appear, the macro waits for it a moment and clicks it as soon as it's there.

2. OCR robots, to wait for a text

An OCR robot watches an area of the screen and reads its text. When the condition you choose is met, for example "The text DOES appear", it runs a macro. The recognition happens on your own PC.

This is the way to wait for a condition with no limit in seconds. The idea is to split the job into two macros:

  1. One macro does the first part: log in, fill in and click the button that starts the loading.
  2. A robot watches the area where the notice will appear, for example "Report ready".
  3. When the robot reads that text, it runs the second macro, which does the rest.
An OCR robot watches an area of the screen and, as soon as it reads “Order ready”, it runs the “Send invoice” macro.

Creating the robot takes three steps: select the region of the screen, confirm the text the program detects in it and set up the condition, the macro and how often it checks. The text doesn't have to match letter for letter: it's enough for it to be contained in what's read, ignoring case and accents.

Best practices

Waiting for a condition is more reliable, but not infallible. These tips will save you surprises:

  • Set a maximum waiting time. If the condition never arrives, the automation shouldn't hang. In OCR robots you can set a maximum duration in minutes and a maximum number of triggers.
  • Have a plan B. Decide what happens if something fails. A robot can stop if the macro returns an error, or alert you with an alarm instead of running a macro.
  • Test with a slow connection. A macro you've only tested with a good connection can fail the day the website is slow.
  • Avoid relying on texts that change. If the notice says "3 minutes left" and then "2 minutes left", choose another part of the message that stays the same.
  • Remember that not every website can be automated. Some sites limit or forbid it in their terms. Respect them.

Step-by-step example

This is an illustrative case, not an example of a real website. Imagine that every morning you go into a portal and download a report that takes a while to generate.

  1. Record the "Request report" macro. Open the portal in your browser, click "Generate report" and stop the recording.
  2. Record the "Download report" macro. With the report already generated, click "Download" and save the file.
  3. Create an OCR robot. Select the area where the portal shows the notice, confirm the text "Report ready" and choose the condition "The text DOES appear".
  4. Assign the "Download report" macro to the robot and give it limits: for example, a maximum duration of 15 minutes and a single trigger.
  5. Start the robot and play "Request report". When "Report ready" appears, the robot will start the download for you, however long the portal takes.

That way, the macro never waits too long or too little: it waits exactly as long as the report takes.

Automate without fixed pauses

If you want to try this approach, you can download Macro Quantic Pro for free from the Microsoft Store. The OCR robots documentation explains each option, and the macro recorder page sums up how it records and plays back.

Frequently asked questions

How do I make a macro wait for a page to load?

Make it wait for a condition, not for a fixed time. In Macro Quantic Pro, the most reliable way today is an OCR robot that watches a text on the page and runs the next macro when it appears.

What's better, a fixed pause or waiting for an element?

Waiting for an element. A fixed pause is always too short or too long on some occasion. Waiting for an element adapts to however long the page takes each time.

What happens if the element never appears?

It depends on the limits you set. An OCR robot with a maximum duration stops when it reaches that time, without running the macro. If you leave it without limits, it keeps watching until you stop it.

Can I use this with desktop programs?

Yes. OCR robots read any area of the screen, whether it's a website or a desktop program. Smart mode also works with desktop programs.

Sources