What is the Difference between wait and synchronization function in QTP. And also please give an idea about what situation wait function can be used , and the situation synchronization function can be used.
Please help me out.
Synchronization point is the time interface between Tool and Application under test. Synchronization point is a feature to specify the delay time between two steps of the test script. For example, clicking on a link may load the page is 1 second, sometimes 5 seconds or even it may take 10 seconds to load it completely.
Hard Wait in UFTThe Wait method can be used to wait for the specified time. The Wait method accepts time in second as input. For example, when you open the browser and navigate to an URL, it may take 3 to 10 seconds to load the login page completely.
The synchronization point timeout for a button to become enabled is set to 10000.
UFT One must be able to identify the specified object to perform a synchronization point. To instruct UFT One to wait for an object to appear, use an Exist or Wait statement.
Browser.Sync
or Page.Sync
waits for the navigation to complete, which means that the page has been downloaded completely and successfully. This does not necessarily mean that all of the elements of the page have been downloaded (i.e., images, CSS, JS).
Wait
is a hard-coded delay (wait X number of seconds). Wait should be avoided as much as possible. The script will run faster and more reliably if you use the built in synchronization functions of QTP (WaitProperty
or Sync
).
Taken directly form the QTP help text, below is a code example which displays an ideal time to use a Browser or Page level Sync.
SystemUtil.Run "iexplore.exe", "http://www.google.com"
Browser("Google").Page("Google").Sync
Browser("Google").Navigate "http://www.cnn.com"
Browser("Google").Page("CNN.com - Breaking News,").Sync
Wait 10 ' we can read the latest news
Browser("Google").Back
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With