Forum Discussion

joe_glogowski's avatar
joe_glogowski
New Contributor
15 years ago

Dynamic Objects with the Same Name

Hi! I am new to Test Complete and have been using the trial
version for a couple of days now. If I can successfully test some of the
modules in our application we plan on purchasing the product.


I am having a problem and moment with ambiguous Objects.


I am using a screen that has dynamically creates combo boxes
when on field is select. See the story line below for details.


App Type: Silverlight 4


1. I click on a Sort Button which brings up the sort dialog


2. When the Sort Dialog loads here is what the screen and
object browser look like. Note the Arrows. 



[See image1.jpg]



3. In the _comboBoxProperty I select Combo Box Item 3, aka
Associated SRCs


[See image2.jpg]



4. Once Selected the _comboboxSortType (previously
invisible) now becomes visible. At the exact same time, a new   _comboBoxProperty
and _comboboxSortType are generated below it with the SAME NAME:


[See image3.jpg]



5. So whenever I try to change the originals _comboboxSortType
I get the Ambiguous recognition of the
tested object.




[See image4.jpg]




-------


Error Messages

[see image5.jpg]



WARNING

There are several objects in the system that match the recognition attributes
of the "zcomboBoxSortType"
mapped object.


This may cause the "Object not found" error.


Objects




Sys.Process("IEXPLORE").Page("http://192.168.20.103:55/Admin/#Branches").Form("aspnetForm").Panel(1).Object("silverlightContainerObject").SlObject("Popup",
"").SlObject("SortDialog",
"").SlObject("_scrollViewerItems").SlObject("_comboBoxSortType")


Sys.Process("IEXPLORE").Page("http://192.168.20.103:55/Admin/#Branches").Form("aspnetForm").Panel(1).Object("silverlightContainerObject").SlObject("Popup",
"").SlObject("SortDialog",
"").SlObject("_scrollViewerItems").SlObject("_comboBoxSortType")



To solve the problem, you may need to modify mapping
settings for the "zcomboBoxSortType"
object or one of its parent objects.


See Help for more
information


ERROR

An error occurred while calling the "Click" method or property of the "ComboBoxItem"
object.

The object or one of its parent objects does not exist.


Tested Object













Alias: Aliases.IEXPLORE.pageAstAdministration1.formAspnetform.panel.objectSilverlightcontainerobject.Popup.SortDialog.zscrollViewerItems.zcomboBoxSortType.Popup.ComboBoxItem
Mapping item: NameMapping.Sys.IEXPLORE.pageAstAdministration1.formAspnetform.panel.objectSilverlightcontainerobject.Popup.SortDialog.zscrollViewerItems.zcomboBoxSortType.Popup.ComboBoxItem

Missing Object













Alias: Aliases.IEXPLORE.pageAstAdministration1.formAspnetform.panel.objectSilverlightcontainerobject.Popup.SortDialog.zscrollViewerItems.zcomboBoxSortType.Popup
Mapping item: NameMapping.Sys.IEXPLORE.pageAstAdministration1.formAspnetform.panel.objectSilverlightcontainerobject.Popup.SortDialog.zscrollViewerItems.zcomboBoxSortType.Popup

Possible causes of the
error








Here is the JavaScript behind these actions


function Test1()


{


 
var iexplore;


 
var scrollViewer;


 
var comboBox;


 
iexplore = Aliases.IEXPLORE;


 
scrollViewer =
iexplore.pageAstAdministration1.formAspnetform.panel.objectSilverlightcontainerobject.Popup.SortDialog.zscrollViewerItems;


 
//_comboBoxProperty Selection


 
comboBox = scrollViewer.zcomboBoxProperty;


 
comboBox.DropDown();


 
comboBox.Popup.ComboBoxItem.Click(67, 4);


 


 
//_comboboxSortType Selection


 
comboBox = scrollViewer.zcomboBoxSortType;


 
comboBox.DropDown();


 
comboBox.Popup.ComboBoxItem.Click(53, 8);


}


--



Can someone please help out?



I figure it has something to do with Object Mapping, but am not having any luck

4 Replies


  • Hi Joe,





    The cause of the issue is that these objects are mapped by their name only. When a second object with the same name appears, TestComplete does not know how to distinguish them. Most probably, these objects have some properties with different values. This can be the 'Id' or 'Index' properties and you can use them to map these objects with different mapping names. To do this, find the _comboBoxProperty and _comboboxSortType objects in the Name Mapping tree and add the Index property as a new identifying property for them. Please find more information in the Modifying Mapping Criteria help topic.
  • khalik's avatar
    khalik
    New Contributor
    Hello David,



    I got the same problem as Joe, and I am new in test complete as well.

    Actually Testcomplete was able to identify the component correctly before until we made some evolution on it which makes it unrecognizable:



    There are several objects in the system that match the recognition attributes
    of the "XXXXXX"
    mapped object.


    This may cause the "Object not found" error.


    Objects




    Sys.Process("XXXXXX")


    Sys.Process("XXXXXX", 2)



    To solve the problem, you may need to modify mapping
    settings for the "XXXXXX"
    object or one of its parent objects.



    Is there any best practice to follow when developing to avoid that kind of issue?  Basically what is needed to a component/object/presenter/etc to be recognizable by Testcomplete?



    We are developing our application in .net using dev express frame works.



    Thanks,



    Kevin






  • Hi Kevin,





    The best way to avoid problems with ambiguous recognition is to always give unique native names to all objects in the tested application. Your example works with process objects. In this case, the best way to get rid of possible problems is to avoid running more than one instance of a process. If this is impossible, you can map the needed process object by its index if it is always the same or by its command line if the needed process is always run with a specific parameter.





    If you get the 'Object Not Found' error, you can find information on how to find the cause of it in the Handling the 'Object Not Found' Errors help topic.