Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Wait() function in QTP
#1
Solved: 10 Years, 9 Months, 1 Week ago
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
Reply
#2
Solved: 10 Years, 9 Months, 1 Week ago
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
Reply
#3
Solved: 10 Years, 9 Months, 1 Week ago
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
Reply
#4
Solved: 10 Years, 9 Months, 1 Week ago
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
Reply
#5
Solved: 10 Years, 9 Months, 1 Week ago
U cn try with
Code:
Browser("abc").page("xyz").sync
or
Code:
browser("abc").page("xyz").exists
Reply
#6
Solved: 10 Years, 9 Months, 1 Week ago
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
Reply
#7
Solved: 10 Years, 9 Months, 1 Week ago
Galstar,
try searching the forum. this topic has been discussed several times. you will find different hold functions utilizing the wait effectively.
Basanth
Give a fish to a man and you feed him for a day..Teach a man how to fish and you feed him for life.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Calling a function in a Test Script from a function library anupam4j 3 5,908 06-26-2015, 12:31 AM
Last Post: babu123
  help with wait property function kp_usa 3 3,987 12-20-2012, 10:49 PM
Last Post: kp_usa
  wait QAVA 1 2,783 11-13-2012, 07:29 PM
Last Post: imzeeshan
  How to control WAIT time with STATIC variable? chong67 3 3,817 06-22-2012, 10:38 AM
Last Post: sshukla12
Exclamation Alternative for Wait Statement Veekay 2 8,277 03-20-2012, 07:13 PM
Last Post: swathi

Forum Jump:


Users browsing this thread: 1 Guest(s)