Forum Discussion

lucieneven's avatar
lucieneven
Contributor
14 years ago

add the object and method manually vs mappedname in object browser

Hello,



This is a generic question about how to add the object and its method manually.



Enclosed is a screenshot, we recorded the script when clicked two links, one is Tools, other is Extensions. Script is like below:



  Set page = iexplore.pageJmapAdmin1

  Set table = page.frameHeading.panelToolbarBox.panelM.panelToolbar.table



  table.cellToolbarTools.linkTools.Click                             'clicking the links of Tools

  table.cellToolbarExtensions.linkExtensions.Click            'clicking the links of Extensions



That's fine. So then we added the scripts like below:



  table.Cell(1, 4).Link(0).Click  'clicking the links of Style Templates

  table.Cell(1, 3).Link(0).Click  'clicking the links of Project

  table.Cell(1, 2).Link(0).Click  'clicking the links of  Data resources  

  table.Cell(1, 1).Link(0).Click   'clicking the links of Database

  table.Cell(1, 0).Link(0).Click    'clicking the links of  JMap Server



Before that, we invoked the Object Spy to verify each links. Basically they are at the same hierarchy, although a little bit strange is, for those two links already recorded, Object Spy can identify them as table.cellToolbarTools.linkTools instead of  table.Cell(a, b).Link(0).



Then we playback the script, and it doesn't work well when reaching the script like table.Cell(x, x).Link(0), that's what we added manually.



Then we noticed one thing, during this test, seems if any elements or components were recorded by TestComplete, Object Spy will show their hierarchy more clear, instead of table.Cell(a, b).Link(0) in this case. Maybe because in Object Browser, MappedName has been already added automatically?



To prove this, we create a new test and recorded one more time on all links, script is like below:



  Set page = iexplore.pageJmapAdmin1

  Set table = page.frameHeading.panelToolbarBox.panelM.panelToolbar.table

  table.cellToolbarTools.linkTools.Click

  table.cellToolbarExtensions.linkExtensions.Click

  table.cellToolbarStyletemplates.linkStyleTemplates.Click

  table.cellToolbarProjects.linkProjects.Click

  table.cellToolbarDatasources.linkSpatialDataSources.Click

  table.cellToolbarDatabases.linkDatabases.Click

  table.cellToolbarJmapserver.linkJmapserver.Click

  table.cell.linkLogout.Click



So here is my question: how to add the object and method manually with the help of Object Spy?



Just try it on using Object Syp randomly on one links which has not been recorded by TestComplete, something like below:



Aliases.IEXPLORE.pageJmapAdmin1.frameCenter.panelElementBox.panelM.Panel(1).Fieldset(0).Table(0).Cell(0, 2).Link(0)



Indeed, i guess if i then call the method like Click(), it won't work directly. As said, seems the MappedName is blank yet in the Object Browser.



This reminded me of Object Repository in QTP which can add objects to repository so that later QTP can identify the objects. Does TestComplete need learn the object firstly before adding script manually? Or i can say, how to add MappedName into Object Broswer if it is a must?



Please help here, thanks!



Lucien
  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor
    There is an option to add items to the NameMapping manually as well.  See the screenshot to see what the button icon looks like for using the GUI.  You can also do this using the Object Browser or by mapping child objects of an already mapped object.



    You can read about this at http://smartbear.com/support/viewarticle/12452/