Loop through links until object found else go back
I have an query about the scenario stated in the title.
Initially I want to click on links in a webtable and after clicking that dynamic link a certain object will need to equal true else if that object does not exist then it will go back and click on the next link until qtp finds that specific object exist and exits the loop
This is what i have gotten so far and not sure if this is the right approach. Any alternative is most welcome. Thank you.
P = Browser("").Page("").WebElement("name").Check (CheckPoint("In Progress"))
Set Desc = Description.Create()
Desc("micClass").Value = "Link"
Set Links = Browser("").Page("").WebTable("").ChildObjects(Des c)
NumberOfItems = Links.Count
For i = 0 To NumberOfItems - 1
If P = True Then
Else If P = False Then
Browser("RMR::Home").Page("").Link("").Click 'go back to the beginning
Re: Loop through links until object found else go back
Thanks for the quick reply.
I need to have a certain condition once it clicks that dynamic link so qtp verifies if the object exists or not, if the object exists then exit loop but if object does not exist then go back to the page and loop until the oject has been verified. The code fails in:
Also tried: Link(i).Click(i + 1)
Still not sure if this is the right approach though. Doesn't even click on the link from my original post. Thank you.