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.
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.
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
© 2022 - 2024 — McMap. All rights reserved.