Micro Focus QTP (UFT) Forums
Alternative for Wait Statement - 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: Alternative for Wait Statement (/Thread-Alternative-for-Wait-Statement--6145)



Alternative for Wait Statement - Veekay - 03-20-2012

Hi,

My Web application sometimes takes 30 seconds to load a page and sometimes its 50 seconds and more.

so while using Wait(30) it fails sometimes and if i use more time..i have to wait till its completed..

Is there any other alternative statement for WAIT, so that once it is completed, QTP will move to the next execution ?

Thanks in Advance
Vijay


RE: Alternative for Wait Statement - ravi.gajul - 03-20-2012

use waitproperty method.
This method is useful for test run synchronization. Unlike the Exist ro wait methods, the WaitProperty method enables you to synchronize the test run based on a specific object property. For example, you can instruct QuickTest to wait for a particular string to appear in a static text control:
' Wait up to 30 seconds for the string "Ready" to appear in the "Status" text control.
Window("Test").Static("Status:").WaitProperty "text", "Ready", 30000



RE: Alternative for Wait Statement - swathi - 03-20-2012

Hi vijay,

sync method: Waits for the browser to complete current navigation.

Code:
'Wait till Gmail browser launches
Browser("title:=Gmail: Email from Google").Sync

Exist statement:We can enter Exist statements to instruct QuickTest to wait for a window to open or an object to appear. Exist statements return a boolean value indicating whether or not an object currently exists.

Code:
'Wait till Gmail browser exists
Do while  
Browser("title:=Gmail: Email from Google").Exist(1) = False  
Wait 1
Loop

Wait Property method:wait until the specified object property value=expected value
Code:
Browser("Yahoo! Mail: The best").Page("Yahoo! Mail: The best").WebEdit("login").WaitProperty "Value", "Inbox", 3000