Micro Focus QTP (UFT) Forums
Wait() function in QTP - 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: Wait() function in QTP (/Thread-Wait-function-in-QTP)



Wait() function in QTP - galstar - 08-19-2010

Hi ,

Can any body suggest me a function which i can use in QTP for following scenario...

As sometimes page navigation take times due to which aur script shows error..For that we use wait(time ) function.But it is a fixed time for which QTP control wait..I want to use a function (heared about sync function,but donn know how to use)..So that QTP waits only for the time ,time taken in navigation (not more/less then it).....


Thanks


RE: Wait() function in QTP - PrabhatN - 08-19-2010

There are several ways you can do this.

If you are testing a Web application, then you can use the "Sync" option as follows:

Browser("xyz").Sync --> It will wait untill all the objects to the browser are loaded.

Or you can make use of "WaitProperty" method as follows:

Code:
Browser("").Page("").WebEdit("").WaitProperty "property","condition",timeout

Property--> It may be visible,disabled,value etc.
Condition-->It may be True,False or any specific value

Please try to explore Insert-->Synchronization Point option in QTP. You can make use of QTP Help file


RE: Wait() function in QTP - galstar - 08-19-2010

Hi
Thanks for the reply..Checkout the code below..

Code:
Browser("Home_2").Page("Home").WebEdit("ctl00$uxMNJDefaultContentPlace").Click
Browser("Home_2").Page("Home").WebEdit("ctl00$uxMNJDefaultContentPlace").Set username 'Read User name from datasheet
Browser("Home_2").Page("Home").WebEdit("ctl00$uxMNJDefaultContentPlace_2").Click
Browser("Home_2").Page("Home").WebEdit("ctl00$uxMNJDefaultContentPlace_2").Set Password'Read Password from datasheet
Browser("Home_2").Page("Home").Link("Sign In").Click

i want to use sync here...how to do it...
As i want a function here that wait only for the time application need not more than it...
as in wait if i add wait(20) then it wait for 20 millisec/sec ,but my page navigation required only 10..
please help me out...Smile
Thanks


RE: Wait() function in QTP - venkatbatchu - 08-19-2010

Hi,

You could use the "waitproperty"

Code:
Browser("xxxxxxxxxxxxxx").Page("xxxxxxxxxx").WebEdit("UserName").WaitProperty "Enabled","True",100000
Browser("xxxxxxxxxxxxxx").Page("xxxxxxxxxx").WebEdit("UserName").Set "uname"
Browser("xxxxxxxxxxxxxx").Page("xxxxxxxxxx").WebEdit("Pass Word").WaitProperty "Enabled","True",100000
Browser("xxxxxxxxxxxxxx").Page("xxxxxxxxxx").WebEdit("Pass Word").Set "pword"
Browser("xxxxxxxxxxxxxx").Page("xxxxxxxxxx").WebButton("Login").WaitProperty "Enabled","True",10000
Browser("xxxxxxxxxxxxxx").Page("xxxxxxxxxx").WebButton("Login").Click

Please let me know for further clarification.

Thanks and Regards,
Venkat.Batchu


RE: Issue related to updation in Reusable Action in QTP - maddy9227 - 08-20-2010

U cn try with
Code:
Browser("abc").page("xyz").sync
or
Code:
browser("abc").page("xyz").exists



RE: Issue related to updation in Reusable Action in QTP - QTPLearn - 08-23-2010

Hi

WaitProperty – instruct QTP to wait the execution process until it matches with the object property value based on the specified time.

E.g.
Code:
Browser("Welcome: Mercury Tours").WaitProperty "name" "Welcome: Mercury Tours" 5000

name - property name

Welcome: Mercury Tours - property value

5000 - number of milli seconds to wait


Wait – Instruct QTP to forcibly wait for specified time period.

E.g. Wait(5) ‘5 Seconds

Exist – method is used to instruct QTP to wait the execution process based on the
specified time and returns Boolean value as per the object existence

E.g.
Code:
If Browser(“Welcome: Mercury Tours”).Exist(5) Then
    
           <Code>


     End If

~Regards


RE: Wait() function in QTP - basanth27 - 08-24-2010

Galstar,
try searching the forum. this topic has been discussed several times. you will find different hold functions utilizing the wait effectively.