I would suggest that, instead of using Delay to delay a fixed amount of time, use one of the various "Wait" functions.
For example, if your object is a VCL Object, you could use WaitVCLObject('Object name', 20000) which will wait up to 20 seconds for the object to appear. If it comes back before the 20 seconds, it will stop waiting and proceed from there.
Please review the help topics for the various wait methods and see if this resolves your problem.
Automated Testing Evangelists
Definition expert - noun - Unknown drip under pressure