Micro Focus QTP (UFT) Forums
Any replacement to Wait() - Printable Version

+- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums)
+-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP)
+--- Forum: UFT / QTP Beginners (https://www.learnqtp.com/forums/Forum-UFT-QTP-Beginners)
+--- Thread: Any replacement to Wait() (/Thread-Any-replacement-to-Wait)



Any replacement to Wait() - srini07 - 11-10-2009

I have a window while launching it is taking time. I am using wait right now. Is there is any better option than wait. If I say wait 10 it is waiting for 10 seconds instead if the browser comes back in 4 seconds I don't want to be waiting for the complete 10 seconds.

Thank you in advance.

Thx
Sri


RE: Any replacement to Wait() - jsknight1969 - 11-11-2009

use a while loop with a condition

Code:
while not found
  if VbWindow("Window").Exist(1) then
    found = true
  end if
wend

Using the exist method with timeout will constantly check for the window to exist and wait the timeout setting for it. Once the object does come up it will set the condition to end the loop and continue.
Another possible method, just a twist on the code.

Code:
While not VbWindow("Window").Exist(1)
wait(1)
wend

Same thing, just a little less code.


RE: Any replacement to Wait() - srini07 - 11-11-2009

jsknight1969, Thank you very much for your immediate response. I will test it and use it.

Thx
Sri


RE: Any replacement to Wait() - sreekanth chilam - 11-11-2009

Hi Srini,

You could use "WaitProperty" method too.

It Waits until the specified object property achieves the specified value or exceeds the specified timeout before continuing to the next step.

Syntax:
object.WaitProperty (PropertyName, PropertyValue, [TimeOut in millisec])

Examples:
Code:
VbWindow("FRMDI General").WaitProperty("Text", "FRMDI General", 10000)
VbWindow("FRMDI General").WaitProperty("enabled",True,10000)

Try it out & see , It would solve your problem easily Smile


RE: Any replacement to Wait() - Tarik Sheth - 11-11-2009

Hi,

You can use theenvironment variable and specify various time wait parameters like
1. waittime for checkbox.
2 Wait time for page.
3. Wait time for table
and like this other controls.

Syntax:
Object.wait("waittime")