Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to end script in QTP if the Do Until loop goes to infinite.
#1
Solved: 10 Years, 9 Months ago
Hi , Can anyone please help with below issue.
I have a Do Until ...Loop condition ,
Code:
Do Until X= "Ordered"  
          Call Login Function
          Browser().page().link().click
         Browser().Page().webbutton("Approve).click
         X = Browser().page().webelement("Status").GetROproperty ("Innertext")  
If  X = "Ordered" Then Exit DO
Loop
every time i login with a different username using datatable, click the required link and click Approve button, for every time i approve, the status changes to "Partially approved", "Approved", "Ordered". my loop continues till it finds the Ordered status
some times, we dont get Ordered status due to some acceptable errors or warnings. in such cases, is their any option to end the loop say after 15 times of exceution and still the ordered status is not found.
Reply
#2
Solved: 10 Years, 9 Months ago
Hi Uma,
Have a counter.

Say

Code:
Counter=1 ' above the do loop

Counter = Counter + 1
If Counter > 15 Then
    End Do
End If
somethign liek this
Reply
#3
Solved: 10 Years, 9 Months ago
Thanks for reply. but I'm not getting where to fit that code in Do loop . if I put the code above do loop i get error at "End DO" as this is not defined . If I fit this in Do loop my logic is missing. can you suggest me pls.
Reply
#4
Solved: 10 Years, 9 Months ago
Code:
For i=1 to 15
Call Login Function
Browser().page().link().click
Browser().Page().webbutton("Approve).click
X = Browser().page().webelement("Status").GetROproperty ("Innertext")
if X = "Ordered" then exit for
next

Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Creating interface in UFT 15.0 for end user sravanmonty 0 757 07-16-2019, 03:47 AM
Last Post: sravanmonty
  Not able to send spacebar with End Key to TE nbansal 1 3,392 02-08-2013, 11:31 PM
Last Post: coolguy
  Can't Identify on Second loop MichaelS 2 3,374 10-07-2011, 07:07 PM
Last Post: MichaelS

Forum Jump:


Users browsing this thread: 2 Guest(s)