Micro Focus QTP (UFT) Forums
Object not found during the 2nd iteration of an Action call in a For loop - Printable Version

+- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums)
+-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP)
+--- Forum: UFT / QTP Beginners (https://www.learnqtp.com/forums/Forum-UFT-QTP-Beginners)
+--- Thread: Object not found during the 2nd iteration of an Action call in a For loop (/Thread-Object-not-found-during-the-2nd-iteration-of-an-Action-call-in-a-For-loop)



Object not found during the 2nd iteration of an Action call in a For loop - BGunay - 04-23-2020

I am testing a Salesforce page with two Contacts links on it as shown in the attached mage.
[attachment=1490]]
I have a loop where I click on each Contact link and its info  shows up in the Contact Profile page.
[attachment=1489]
I then call an Action to check various values on that Contact Profile page.
Set oDesc = Description.Create
oDesc("micclass").value = "WebTable"

Set obj = Browser("Contacts | Salesforce").Page("Contacts | Salesforce").ChildObjects(oDesc)
rowCount = obj(0).GetROProperty("rows")
For i = 2 to rowCount
       Set ObjChildItem = obj(0).ChildItem(i,3,"Link", 0)
        ' bring up Contact Profile page                                                                                                                                                  ObjChildItem.Click()       

        ' Valdate values on the Contact Profile page     
         RunAction "ValidateContactProperties", oneIteration
            
  Next
      --------           ValidateContactProperties action --------------------

' select the Details tab on a webstrip (I'm using Google Chrome)
Browser("abc").Page("abc").WebTabStrip("RelatedDetailsNewsMore").Select "Details"
........
 'Go back to the previous page. If you remove this code, only the first contact profile will be displayed in the browser.
   Browser("abc").Back

-----------------------------------------------------
The problem is when ValidateContactProperties is run the 2nd time from the loop, the objects on the Contact Profile page are not being recognized. Possibly the DOM is getting messed up.

How can I fix this?