QTP Sync

Explain about Sync with an example

Questions by pvinod02

Editorial / Best Answer

ch.bhaskar.mca  

  • Member Since Oct-2007 | Apr 6th, 2011


Hi,

As the name specifies, "Synchronization Point" is nothing but to say QTP to wait till some specified condition occurs. You can specify the conditions.

We need Synchronization Point because we are always not sure how much time it takes for an Object to get loaded to a page/window.

Let's take an example of "Login" page of any application. You want to provide "UserName" in the UserName field after opening the site via QTP.We can provide value only after "UserName" field is visible. But sometime it may take 10 seconds for the "UserName" field to be appear in the Login page. Sometime it may take 30 seconds (Depends upon the internet speed).At this point QTP script fails as the object is not displayed in the page. So here what we do through "Synchronization Point" is to tell QTP to wait untill the "UserName" field appears on the page, may it take 10 secs or 30 secs.

There are 2 ways (for Web Application) you can acheive this as follows:

Quote:> Browser("").Sync (Only in case of Web App) : QTP waits untill all the objects are loaded to the Browser

> WaitProperty (Any type of App) : QTP waits untill the specified condition is satisfied
Following is an example of "WaitProperty"

Quote:Syntax: Object.WaitProperty "Property Type","Property Value",TimeOut

Ex: Browser("Login").Page("Login").WebEdit("UserName").WaitProperty "visible",True,20000
Browser("Login").Page("Login").WebEdit("UserName").Set "bhaskar"

In the above example QTP waits untill the WebEdit "UserName" is visible in the page.Then it sets the UserName in the field.

Hope it helps you.

Showing Answers 1 - 0 of 0 Answers

Hi,

As the name specifies, "Synchronization Point" is nothing but to say QTP to wait till some specified condition occurs. You can specify the conditions.

We need Synchronization Point because we are always not sure how much time it takes for an Object to get loaded to a page/window.

Let's take an example of "Login" page of any application. You want to provide "UserName" in the UserName field after opening the site via QTP.We can provide value only after "UserName" field is visible. But sometime it may take 10 seconds for the "UserName" field to be appear in the Login page. Sometime it may take 30 seconds (Depends upon the internet speed).At this point QTP script fails as the object is not displayed in the page. So here what we do through "Synchronization Point" is to tell QTP to wait untill the "UserName" field appears on the page, may it take 10 secs or 30 secs.

There are 2 ways (for Web Application) you can acheive this as follows:

Quote:> Browser("").Sync (Only in case of Web App) : QTP waits untill all the objects are loaded to the Browser

> WaitProperty (Any type of App) : QTP waits untill the specified condition is satisfied
Following is an example of "WaitProperty"

Quote:Syntax: Object.WaitProperty "Property Type","Property Value",TimeOut

Ex: Browser("Login").Page("Login").WebEdit("UserName").WaitProperty "visible",True,20000
Browser("Login").Page("Login").WebEdit("UserName").Set "bhaskar"

In the above example QTP waits untill the WebEdit "UserName" is visible in the page.Then it sets the UserName in the field.

Hope it helps you.

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions