Use System.Timeout.timeout to limit waitForPresence to 10 seconds.