This subject was much discussed in this topic:
Wait only until the very moment that Chrome finishes loading?
I doubt there is a completely fool-proof way of doing this, short of having a excessive manual pause time.
So, here is my attempt to provide a reusable Sub-Macro that will open a URL and wait until it has completed loading. You can call this Sub-Macro from any Macro using the Execute a Macro action (KM Wiki).
Please let me know if you have any issues or suggestions for improvement concerning this macro.
Below I have also uploaded a Macro to test this Sub-Macro.
UPDATED: 2018-08-06 13:21 GMT-5
• Fix broken link in Download link
MACRO: Open Web Page & Pause Until Load Complete [Sub-Macro]
~~~ VER: 2.0 2017-11-15 ~~~
Open Web Page & Pause Until Load Complete [Sub-Macro].kmmacros (90 KB)
Note: This Macro was uploaded in a DISABLED state. You must enable before it can be triggered.
You may call this sub-macro with a parameter like this: <OpenWhere>,<URL> where <OpenWhere> is one of the following: "win" -- open the URL in a new window "tab" -- open the URL in a new tab <URL> -- URL to be opened For example: win,http://www.apple.com OR, just <URL> and the URL will be opened in the existing window/tab. If no Parameter is provided, then the Sub-Macro will CANCEL itself and the calling macro.
Open Safari or Chrome to URL, & Wait Until It is Loaded
- It should NOT be directly triggered, but called from another Macro using the Execute Macro Action.
- It uses the new KM8 FrontMost Browser Actions, so it should work with both Safari and Chrome.
- KM 8.0.4+
- But it can be written in KM 7.3.1+
- It is KM8 specific just because some of the Actions have changed to make things simpler, but equivalent Actions are available in KM 7.3.1.
- macOS 10.11.6 (El Capitan)
- KM 8 Requires Yosemite or later, so this macro will probably run on Yosemite, but I make no guarantees.
NOTICE: This macro/script is just an Example
- It has had very limited testing.
- You need to test further before using in a production environment.
- It does not have extensive error checking/handling.
- It may not be complete. It is provided as an example to show you one approach to solving a problem.
HOW TO USE:
- Call this SUB-MACRO by using an Execute Macro Action in another Macro
- In the Execute Macro, set the Parameter as indicated in the next Comment Action
Carefully review the Release Notes and the Macro Actions
- Make sure you understand what the Macro will do.
- You are responsible for running the Macro, not me.
- Move this macro to a Macro Group that is only Active when you need this Macro.
- ENABLE this Macro.
TAGS: @Web @Safari @Chrome @PauseUntil @SubMacro
- There are NO Actions or settings in this Macro that are intended to be changed by the user.
- Of course, like any macro, you can customize it as you like.
- However, be careful before making any non-cosmetic changes
- The process/actions used were developed after considerable research and testing.
- You could break this macro if you are not careful.
USE AT YOUR OWN RISK
- While I have given this limited testing, and to the best of my knowledge will do no harm, I cannot guarantee it.
- If you have any doubts or questions:
- Ask first
- Turn on the KM Debugger from the KM Status Menu, and step through the macro, making sure you understand what it is doing with each Action.