Forum Discussion

vex's avatar
vex
Contributor
14 years ago

Object Exists but TC doesn't see it.

This code isn't working as I'm expecting it to.  Any ideas?





      PropName  = Array("ObjectType")

      PropValue = Array("Checkbox")

      res       = yhooFile.FindAllChildren(PropName, PropValue, 20000, True)



      For i = 0 to UBound(res)

        If res(i).idStr = fDiz Then

          Log.Message "A Match!"

          Log.Message res(i).Exists

          If res(i).Exists Then

            Log.Message "It exists!"

            Call res(i).Click

          End If

          Log.Message "Clicked it!"

        End If      

      Next





The output in my log is:



A Match!

False

Clicked it!



How can TestComplete get the idStr/Any other property from this item, yet this item doesn't exist?  If I use the object spy, it shows Exists is true, but during execution it is ALWAYS false..  yet it reads properties and the like from it without problems.
  • vex's avatar
    vex
    Contributor
    Just fixed this problem.



    I thought the FindAllChildren did a proper refresh if you state true like I did???



    I had to tack on a Call Sys.Refresh() before the FindAllChildren action and it worked.  Why would that be needed?
  • Hi Vince,


    Actually, if you set the Refresh parameter of the FindAllChildren method to True, there is no need to call the Refresh method. It looks like the FindAllChildren method works incorrectly.


    To help us reproduce the problem, please send us the application under test along with the test project you are using via the Contact Support form.