Seems like the build in action "for waiting for safari to finish loading" doesn't work.
This script should work but it doesn't, it shows the page has completed loading while it keeps loading.
tell application "Safari"
set sameURL to URL of tab 2 of front window
set URL of tab 2 of front window to sameURL
set t to ""
tell application "Safari" to tell tab 2 of window 1
repeat until t is "complete"
The only solution that I could manage and which actually works is to refresh the page and run JS periodically to check if the page contains some text or an element - That means the page has finished loading.
Sadly, this no longer works. With an update to Safari about a year ago the Stop menu now is always enabled. For the Wait For Front Browser to Finish Loading action, Keyboard Maestro checks the Stop menu (but no longer in Safari since it is no longer useful), and then document.readyState is “complete”. It continuously checks this until it remains “complete” for the specified time in the action.