Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Do Until Loop issue
#1
Solved: 11 Years, 3 Months, 3 Weeks ago
Can anyone help me straighten out my Do Loop?

Code:
Do Until Browser("Wisdom").Page("WisdomLogin").Frame("parent").WebElement("Account Documents", "visable:=" &True).Exist(0)
    Wait(1)
Loop
Thx
Reply
#2
Solved: 11 Years, 3 Months, 3 Weeks ago
If you are using this loop to verify if the web element is visible or not, then you can also use the following

Code:
sLoop = True
Do Until sLoop
If cStr(Browser().Page().Frame().WebElement("Account Documents").GetROProperty("Visible")) = "True" Then
    sLoop = False
else
   wait(1)
End if
Loop
Reply
#3
Solved: 11 Years, 3 Months, 3 Weeks ago
Thx, I will give this a try. I just thought I could pull this off all in three lines. I guess not. ;-) thxx
Reply
#4
Solved: 11 Years, 3 Months, 3 Weeks ago
Hi Guys,

Just think out of box, what will happen if the application is crashed once the do loop is initiated? The script will never come back.

So the best practice is when ever you are using do loop make sure you have initiate the time elapse.
Below is the snippet, if you feel it's worth keeping the time then you can goahead and use this.
Code:
Dim strInitialTime  : strInitialTime = Now()
Dim boolFlag : boolFlag = False
Do until boolFlag = False or DateDiff("n",strCurrentTime,Now())< 3
  'here you can specify your condition to check.
  'First of all Check whether that object exist or not
  If Browser().Page().Frame().WebElement("Account Documents").Exist(0) Then
     If Browser().Page().Frame().WebElement("Account Documents").GetROProperty("Visible") = True Then
       boolFlag = True
     Else
       wait 1
     End If
  Else
     msgbox "Specified object doesn't exist.
     ExitDo
  End If
Loop
If boolFlag = False Then
msgbox "Object does not meet the condition with in 3 minutes."
End If
Please let me know if you need any further info.
Thanks,
SUpputuri
Reply
#5
Solved: 11 Years, 3 Months, 3 Weeks ago
Perfect, im clear ;-)

thx Supputuri
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  FOR LOOP shayk1985 1 5,297 12-13-2012, 11:35 AM
Last Post: sams001
  How to exit from a for loop silpavinod 2 9,869 10-17-2012, 12:55 AM
Last Post: agarwl.anurag
  for loop sia sharma 1 3,340 09-13-2012, 11:44 AM
Last Post: ksrikanth2k9
  Help with Loop LJENNE 1 3,184 08-10-2012, 12:32 PM
Last Post: Ankesh
  How to get out of infinite FOR loop... sssidana 3 4,557 07-20-2012, 01:04 AM
Last Post: sree.85

Forum Jump:


Users browsing this thread: 2 Guest(s)