Forum Discussion

Kate's avatar
Kate
Contributor
7 years ago

dump object browser

Is there a way to make a 'dump' or a 'snapshot' of the object browser?

I want to take a look on the object browser if TestExecute faces 'element not found' or 'not visible' error. On the screenshot made at the error moment I see that my element is there, but TE cannot recognize it.
The issue appears on virtual machines and with TE only. On host with TestComplete running the tests I do not face that issue...

 

The object browser refreshes, pauses added, but still...

 

Will appreciate any comments and suggestions.

4 Replies

  • Bobik's avatar
    Bobik
    Frequent Contributor

    You could use "SaveObjectSnapshotToFile()" function. It can dump objects tree with their properties and values to the file. Then you can load it into TC Object browser.

    https://support.smartbear.com/testcomplete/docs/reference/program-objects/aqobject/saveobjecttofile.html?q=SaveObjectSnapshotToFile

     

    How to load snapshot to the object browser

    https://support.smartbear.com/testcomplete/docs/testing-with/exploring-apps/object-browser/snapshots.html?q=SaveObjectSnapshotToFile

  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor

    Not as such, no.  I've had similar problems in the past (not quite the same as yours) and what I ended up doing was throwing together some code around the fail point that, when the object recognition failed, I'd write out to the log the entire hierarchy tree.  Unfortunately, I'm not sure that's going to fix your problem because you don't need the hierarchy tree but the properties of the object you're looking for... which you can't get to via code because you can't identify the object.

     

    So... what we need to look for, then, is what is different in TE from your TC configuration that is possibly causing this problem... or, if there's something different in the environment.

     

    I know probably a "duh" question, but is your VM the same OS as your machine running TC?  That's something that MIGHT make a difference depending upon the application being tested.

     

    Another thing:  In your TC configuration, under Tools -> Options -> Engines -> NameMapping there's a check box for "Search for visible objects first".  Whatever setting you have there, make sure that setting is the same in your TE installation.  This is an option that's configured as part of the tool and does not transfer with the automation project.

     

    Finally, could you post the "offending" code?  What function, section of code, etc, is generating the errors?  Please post, if you can, the full function and not just the offending line (or screenshot of the Keyword test if it's not code) as it might not be the fault of the identification of the object but events leading up to it.  Additionally, if you can post screenshots of the object itself in the object browser of your TC installation with properties included as well as the NameMapping configuration for the object, that will be helpful as well.

    • Kate's avatar
      Kate
      Contributor

      My vms' OSs are definitely different from OS on my host machine. That's actually the main point why I use virtual machines - to test my app with different OSs.
      My code uses .Visible property.

    • tristaanogre's avatar
      tristaanogre
      Esteemed Contributor

      Double check that option that I mentioned earlier.  If you're using the "Visible" property but the object is not visible right away, you may get some odd errors.