It would be nice if WebUI could provide something like the answer I proposed in this post natively.
The sentinel name would need to be more robust using perhaps a uuid-based name.
String jsSentinelTest = 'return something !== ""'; String sentinel = WebUI.startSentinel("russ", jsSentinelTest) WebUI.waitSentinel(sentinel, TIMEOUT_SECONDS)
jsSentinelTest can be as complex as required.
String sentinel becomes
"russ" + uuid (without hyphens maybe)
WebUI.waitSentinel waits max TIMEOUT_SECONDS for
jsSentinelTest to return
WebUI.startSentinel sets up the sentinel value on the browser’s window object (if needed, because the
jsSentinelTest may be enough).
||Sets up a sentinel with the given name. Returns the fully qualified name:
||Waits until the named sentinel returns true.|
||Pauses initialDelay seconds then waits until the named sentinel returns true.|
I wrote this off the top of my head when the idea struck me - it could be complete nonsense or I may have missed something
Note: You may prefer state everywhere I stated sentinel (waitState, etc). I prefer sentinel, it’s more generic.