Synchronization in QTP or UFT

Synchronization in QTP/UFT:

Synchronization is an effective solution to make the tool(UFT/QTP) and the application under test to work together by coping up the execution speed differences between themselves. By this, we can add specific wait or delay time between the steps of a test.

Synchronization makes available a specified amount of time for an object to process before moving to the next step. So when we run a test or component(in BPT) our application may not always respond at the same speed as our computer does.

As the process it a little complicated with a client-server architecture. Once the request goes to the server, it processes the request and sends the result back to the client browser or client application.

Now in the client, the UFT/QTP is running at full speed. This causes the synchronization issue. In summary, the synchronization takes care between the timing issue between UFT, browser, and server.

Let’s look into a live example.

Synchronization is referred to as waiting time, in the sense, that if we have an application in which we have 3 steps for example. Let’s say we are recording the steps where the first step is to enter the information, the second step is clicking the submit button and the third step is to get the order No.

This is like our flight reservation system. Now when we click submit button it may take a few seconds to several minutes depending on the application or internet speed. After that, we can get the order no.

But when we play this in QTP/UFT it does it very fast, it does not wait for the processing of information after we click the submit button and may try to get the order no before it is getting generated which will give the error.

So, to overcome such problems we insert synchronization points. By inserting the synchronization point we are asking QTP to wait till the order no is getting generated and then retrieve the order no. It is a process of matching the speeds of both QTP and AUT in order to get proper execution and results. So Synchronization acts as a time interface between the tool(QTP or UFT) and the underlying application(UAT).

See also  Learn UFT Step By Step Manner in a Fast Pace

Where Synchronization is required:

During test execution, QTP/UFT gives instructions one by one with the same speed, but AUT takes less time for some operations execution and more time for some operations execution, that time we may not get proper execution and results. In order to get proper results in between QTP & AUT synchronization is required.

Below are the scenario where it is required to use synchronization:

  • For client-server communications to finish.
  • For a window or pop-up message to open.
  • For a screen to change its component status like button gets enabled or disabled/ based on some dropdown the other dropdown values change etc.
  • For the progress bar to complete 100%.
  • For completing the transaction.
  • For a web page to load.

So we can handle a synchronization issue by anticipated time and by synchronization of our test or component to ensure the required component and script is ready to take up the next step.

Methods available in UFT/QTP to cope up with Synchronization

There are several methods available in QTP for synchronization.

  1. Inserting Wait statements.
  2. Inserting waitproperty
  3. Inserting Synchronization points.
  4. Increasing Tool default synchronization time.
  5. Sync Method (Only for WEB)
  6. Exist Property
  7. Increasing the default time amount.

Inserting Wait Statements:

We can insert wait for statements in our test in order to make QTP/UFT wait until AUT completes the current operation. The wait is a hard-coded delay (wait X number of seconds). The wait should be avoided as much as possible.

The script will run faster and more reliably if we use the built-in synchronization functions of QTP /UFT (WaitProperty or Sync). This command is used to stop QTP(forcefully) for the specified time.

If we are very sure within that time frame the Application is bound to open, It is very smart to use it. The execution time may go high due to its usage.


Wait(time in seconds)

Note: If we insert wait for statements QTP waits up to maximum time even though the operation is completed. The wait is a hardcoded sync point. Wait() method is a forcible wait.

See also  How To Implement Replace Function Without Using The Inbuilt String Function

Inserting Synchronization point:

  • Place cursor in desired location
  • keep tool under recording mode
  • Insert menu > Synchronization point > show the object > click ok >
  • select property name & Value (True)
  • enter time in Milliseconds
  • Click ok>Stop recording.

Note: if we insert Synchronization points, it does not wait up to maximum time, after completion of the current operations, it goes to the next step immediately.

object hierarchy.waitproperty "property name",value,time in milliseconds.

Increasing Tool default synchronization time:


  • We need open Recording mode to enable this feature.
  • We need to go to design | Synchronization Point
  • We have to select the object for which we want to insert the sync point.
  • After selecting the appropiate object we need to click on OK button.
  • At this point the Add Synchronization Window pops up.
  • We need to insert Property,value and TimeOut value.
Add Synchronization Point
Add Synchronization Point


File>settings>run tab>increase object synchronization time out>apply>ok

UFT Run Tab
UFT Run Tab

Note: If we increase QTP tool default time that can be applied for all statements in the test, but QTP does not wait up to maximum time unnecessarily, After completion of one statement execution it goes to the next statement immediately. Sync Method: (only for WEB)

Waits for the browser to complete current navigation.


Object Hirearchy.Sync 
Browser("Yahoo! Toolbar").Page("Yahoo! Toolbar").Sync 

Selecting an appropriate Method:

Suppose in our test one or more statements only are taking more time for execution then selecting the “Inserting synchronization method” is better. Suppose in our test more statements are taking more time for execution then selecting “increasing tool time out”.The above two are local features but the wait statement is the Vbscript feature, even though some drawbacks are there in using the wait statement, it is better to use the wait statement in functions.

How to Use WaitProperty?

WaitProperty takes input as the property name, Value, and Timeout value and waits for the property to appear in the screen for the specified Timeout value.

Syntax –

object.WaitProperty(PropertyName, PropertyValue, [TimeOut])

(TimeOut Parameter is optional, in case it is not given it would take the default synchronization time “File –> Setting –> Run –> Object synchronization timeout”)

Set object = Browser("CreationTime:=0").Page("Index:=0").Link("text:=Accounts", "html tag:=A").WaitProperty "text","Accounts",3000
Browser("CreationTime:=0").Page("Index:=0").Link("text:=Accounts", "html tag:=A").WaitProperty "text","Accounts",3000 

WaitProperty is better than hard wait and semi dynamic in nature.  The exution time may go high due to its usage.

See also  Learn Object Repository in UFT in An Efficient and Fast Manner

How to use Exist in UFT or QTP?

Exist takes input as the Timeout value to sync. It waits for the specified timeout value to check if the object has appeared or not.

Set object = Browser("CreationTime:=0").Page("Index:=0").Link("text:=Accounts", "html tag:=A")
If object.Exist(5) Then
End If 

Exist() method is also a semi forcible wait. The exution time may go high due to its usage.

Sync Method

Sync Method can be used only for web applications where there is always a lag between page loads.
Syntax –




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). It is only applicable for web applications.

Asynchronous browser and scripting:

UFT/QTP  does not support asynchronous browser scripting(ajax) in a direct way.For these cases, we can use the browser’s readyState or busy property.
The syntax is as follows:

until ie.readyState = 4 loop
busyCode= Browser("CreationTime:=0").getROProperty("busy")

However they are not that reliable.

A sure-fire Approach:

We can change the code a little bit

until Browser().Page().Object.Exits(2) loop 


Another approach I liked:

Function WaitForObject(obj)
WaitForObject = false
Setting("DefaultTimeout") = 500
for i = 0 to 30 'or more
If obj.Exist Then
WaitForObject = true
Exit For
End If
Setting("DefaultTimeout") = 20000 ' or other value
End Function


To my point of view the best approach is
'ARGUMENTS : obj,Max_Wait,result
'DESCRIPTION : Waits for Oracle Navigator
'RETURNS : None '
Function F_Sync (obj,Max_Wait)
Dim Wait_Time flag_wait = "False"
If obj.Exist(2) then
Else Wait_Time=Wait_Time+5 
If Wait_Time> Max_Wait Then 
Exit do 
End If 
End If 
loop until flag_wait = "True" 
End Function
obj will be
Set obj=Browser("ABC").Page("VCV")

Instead of String, we can use boolean as well.


Share and Enjoy !

9 thoughts on “Synchronization in QTP or UFT

  1. Hello!

    I’ll keep this brief and to the point as I know you’re busy. I found your site today and noticed it’s not ranking well on
    Google for some of your main keywords, not where they should be anyway.

    I currently have a free 30-day SEO trial offer on my site and wanted to see if you’d be
    interested in letting me help you improve your on-page SEO and get some fresh backlinks
    flowing to your site.

    Have a great day and I’ll talk to you soon!

    Kind regards,

  2. It’s really a cool and useful piece of information. I am glad that you shared this useful info with us. Please keep us up to date like this. Thanks for sharing.

  3. Enjoyed reading the article above, actually explains everything in detai,
    ,the article is extremely interesting and effective.
    King regards,
    Abildgaard Schneider

  4. Pingback: Google
  5. Thank you for the auspicious writeup. It in fact was a amusement account it.

    Look advanced to more added agreeable from you! By the way, how
    could we communicate?

  6. Pingback: Google
  7. Pingback: Google
  8. Wow in truth a huge post. I like this.I just passed this onto a colleague who was doing a little research on that. And he actually bought me lunch because I found it for him. Overall, Lots of great information and inspiration, both of which we all need!

Leave a Reply

Your email address will not be published. Required fields are marked *