A better way is to wait for the object, with a time out (say 10 seconds) this way you can handle failures too and variations between machines.
(this is psudo code while loop is probably better)
(this is psudo code while loop is probably better)
Code:
continue = false
for x = 1 to 10
if (object exists) then
continue = true
x = 10
endif
wait(1000)
next
if continue <> true then (fail with approperate error)