Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Alternative for wait statement.
#1
Solved: 11 Years, 3 Months, 1 Week ago
[/align]QTP 9.5 Build 194 - Testing web application (DNN)

The action is Search for a user -> Once the record is retrieved, click on the delete button next the retrieved record and it generated the following code, without the "wait" statement in between.

[color]Browser("QA SOL Portal > Home").Page("User Accounts").Image("dnn$ctr2508$Users$btnSearch").Click 11,6
wait(20)
Browser("QA SOL Portal > Home").Page("User Accounts_4").Image("dnn$ctr2508$Users$grdUsers$ctl").Click 6,6[/color]

It did not work without the wait statement as it went to the next line right after the search action without waiting for the record to be retrieved. Since the record was not there, it could not find the delete button which caused the script to fail.

Is there any way, other than using wait command, to make the script to wait for the record to be retrieved before executing the next statement?

Thanks,
Binu.
Reply
#2
Solved: 11 Years, 3 Months, 1 Week ago
I don't know if this works for browsers, but this is what I do on the clients. I would something like.

Code:
For i = 1 to 20
if Browser("QA SOL Portal > Home").Page("User Accounts_4").Exist(0)=True Then
Exit For
else
Wait 1
End If

So once the page is loaded it will stop the wait.
Reply
#3
Solved: 11 Years, 3 Months, 1 Week ago
Hi ,

Use "WaitProperty" method.

Refer the below example:
The following example uses the 'WaitProperty' method to wait for the required WebButton's 'readyState' property to be complete or for 10 seconds (10000 milliseconds) to pass, whichever comes first.
If the WebButton achieves this value for '4' seconds itself, then QTP clicks the button & ignores the remaining '6' seconds.

Example:
Code:
If Browser("....").Page("....").WebButton("....").WaitProperty("readyState", "Complete", 10000) Then
    Browser("....").Page("....").WebButton("....").Click
End If
Reply
#4
Solved: 11 Years, 3 Months, 1 Week ago
Hi,

You can use the while wend as well.

Code:
While Browser("....").Object.Busy = True
'Do Nothing
Wend

Or you can insert Wait statement within it. But put wait only for 2 seconds or so, so that the moment object is loaded it does not go for the Wait statement inside.

Code:
While Browser("....").Object.Busy = True
Wait (2)
Wend


HTH
Vijayendra
Reply
#5
Solved: 11 Years, 3 Months, 1 Week ago
I was able to get this done using the while loop. Thank you, everyone, for the help.

Thanks,
Binu.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  help with wait property function kp_usa 3 4,250 12-20-2012, 10:49 PM
Last Post: kp_usa
  wait QAVA 1 2,983 11-13-2012, 07:29 PM
Last Post: imzeeshan
  How to control WAIT time with STATIC variable? chong67 3 3,956 06-22-2012, 10:38 AM
Last Post: sshukla12
Exclamation Alternative for Wait Statement Veekay 2 8,528 03-20-2012, 07:13 PM
Last Post: swathi
  Verifying the value exists and if not, wait up to 5min HeZma 3 4,028 02-25-2012, 12:21 PM
Last Post: rajpes

Forum Jump:


Users browsing this thread: 2 Guest(s)