Forum Discussion

megha_gambhire's avatar
megha_gambhire
Contributor
13 years ago

Object not found in Object browser

I recorded a Test and try to play it. It failed  and gives message 'The Object does not exist' I then traced the steps to Object browser. But it gives message ' Unable to highlight the object in Object browser as the Object does not exist in the Object browser.

7 Replies

  • irina_lukina's avatar
    irina_lukina
    Super Contributor

    Hi Megha,


    Playing back the tests with TestComplete requires that all the tested applications and controls be in the same state they were before recording the test. In other words, if you opened the tested application before the recording and closed it at the end of your test, you will have to open this application manually each time before running the recorded test.


    So, most likely, when you started playing back the test, TestComplete failed to find the object that existed during the recording, but didn't exist during the test run. For more information, please refer to the Handling the 'Object Does Not Exist' Error help topic.


    Does this help?

  • Thanks Irina for your valuable reply. But it worked 2/ 3 days back for the same application. Now the problem i observed is that i have 'Uncheck the Stop on error' property.And I am testing it on VM machime.Appllication window takes time to Launch. I have increaed the Default Wait time to 20000.  And observed that even though the Window not visible the test run and shows the staus 'waiting for object....' And at certain step failed giving the error 'Object not found'.



    I have exp with QTP and its Object repository. Will you please explain how the object repository worked here it Test complete.



    I have read the related articles from Smart Bear but frankly not getting clear on how the Object browser worked here.How to chnge the long displyaing object name ?
  • irina_lukina's avatar
    irina_lukina
    Super Contributor

    Hi Megha,


    Will you please explain how the object repository worked here it Test complete.


    TestComplete has no object repository. The Object Browser panel doesn't contain the tested objects. It's used to explore processes, windows, objects and its methods and properties. You can obtain any running application or process using the Object Browser and then obtain the target object that belongs to it using the tree-type structure shown in the panel.


    How to chnge the long displyaing object name?


    For this purpose, TestComplete includes the Name Mapping feature that lets you specify custom names for the tested applications and controls. This feature is enabled in TestComplete by default. When TestComplete records a test, it usually maps the objects and then uses these mapped names in tests. To learn how TestComplete assigns names to objects, please refer to the Name Mapping - Overview help topic.


    But it worked 2/ 3 days back for the same application.


    Are use sure that the object hierarchy used in the application hasn't changed? If it has, TestComplete will fail to find the needed objects and will show the mentioned error. So, I recommend that you open your application and check whether its structure corresponds to the objects structure used in the Name Mapping editor.


    Please let me know the results you get. Thanks :)

  • Hi Irina, thnks a lot for your explanation.



    My Object hierarchy does not chnages because i used same Build. Please find the attached screen shot for Mapped Object and Object Browser.



    Also If Test complete does not store the Objects then , how it run the same if we save and play the script ? I mean how it identify the object properties ?



    Also when I Right click on some of Object from Mapped Object > It show error ' Unable to highlight the object ..... as Underline object doe not exist.



    What Aliases. Drag Mapped object here do ?



    How to map the Object ? Will you please explain as it is difficult to undertsant it from the Smart bear Articles ?


  • AlexeyK's avatar
    AlexeyK
    SmartBear Alumni (Retired)

    Hi Megha,


    As far as I can see, the images display different objects. The Object Browser image shows a top-level window which is not mapped (its MappedName is empty). The Mapped Objects image shows a mapped button (not a top-level window). So, now I tend to think that either your application has changed, or the mapping settings do not correspond to actual property values.


    Also If Test complete does not store the Objects then , how it run the same if we save and play the script ? I mean how it identify the object properties ?


    Each process, window or control that exists in the operating system has a number of properties. Some of these properties may change from one application build to another (for instance, screen coordinates) or even from one application run to another run. Some other properties are quite persistent (for instance, the control name specified in the application source code).


    As you can see in the Object Browser, quite often, an object name is a combination of several values, for instance, Window("IME", "Default IME", 2). These parts are values of certain properties that are typically persistent (that is, do not change often) and can be used to identify an object. So, during the test run, TestComplete searches for the object, whose property values match the values specified in the object name. That is, in your test, you can work with any object, not just with those you added to some kind of "repository".


    However, quite often, these names are quite long, or properties used for identification are not persistent. In such cases, you can define shorter, readable, human-friendly names for the objects and also redefine the set of identification properties (if needed). This is similar to QTP Object Repository. We call this Name Mapping. TestComplete maps object names automatically during the test recording. That is why, you see shorter names in tests and long names in the Object Browser.


    When an object is mapped, TestComplete searches for it using the identification properties specified by the name mapping settings.

    These are properties you can set for an object in the Name Mapping editor. The editor has the Mapped Objects tree and the Aliases tree.


    What Aliases. Drag Mapped object here do ?


    When an object name is mapped (either by you, or by TestComplete), TestComplete maps the object and all its parent objects. The mapped hierarchy is shown in the Mapped Objects tree. What do you need this tree for? The fact is that the search takes some time and mapping the parent objects narrows the amount of objects to be checked. For example, searching for a window among all the windows existing in the operating system will take much longer if you first search for the needed process and then for the needed window in this process.


    The hierarchy of mapped objects can be deep (that is, it may include many levels), which can make addressing objects inconvenient. In this case, you can create an Alias for an object. An alias lets you skip some mapping items in tests and use a shorter notation. For example, instead of NameMapping.MyProcess.MyForm.HelperPanel1.HelperPanel2.HelperPanel3.HelperPanelN.MyButton, you can just use Aliases.MyProcess.MyForm.MyButton.


    An alias links to the name mapping item, for which it was created, that is,


    Alias (if it is used) ->

        Name mapping item ->

           Underlying object in the application


    Also when I Right click on some of Object from Mapped Object > It show error ' Unable to highlight the object ..... as Underline object doe not exist.


    This error indicates that the object, to which an alias or mapping item refers, does not exist. Please ensure the application is launched, the form that contains the object is visible, the object exists on it, and so on. If the error still occurs, please check the mapping settings in the Mapped Objects section of the Name Mapping editor. Perhaps, the settings do not match the actual property values.


    How to map the Object ? Will you please explain as it is difficult to undertsant it from the Smart bear Articles ?


    This is done automatically during the test recording. You can also do this manually: find the needed object in the Object Explorer, right-click it there, select Map Objects and then follow the instructions of the subsequent wizard. Also, you can click the "Map Object From Screen" button on the TestComplete toolbar and select the object on the screen and then follow the wizard instructions.

  • I have the same problem.

     

    when i installed this app record and play worked fine ,after few play failed saying "Object not found".. so i rerecorded the test and it failed again during play back.



    its not identifing dockedbar control during playback"
  • TanyaYatskovska's avatar
    TanyaYatskovska
    SmartBear Alumni (Retired)
    Hi Abhilash,

     


    In the Additional Information tab of the error in Test Log, you should see a detailed description of the error, as well as the link to the article containing the troubleshooting steps. I suggest that you follow it to find out what is going on.