If waitForClientExecuteScript also works for me, if it combining both operations. I'm also assuming it would be a polling script, waiting for a truthy value before continuing, as I believe this script does.