Forum Discussion

shivashish's avatar
shivashish
Occasional Contributor
13 years ago

Confusion between DOM and TreeView model


Hi,


 I am very new to Test Complete and have found
the tool very useful in trying to automate our web applications. I have gone
through the online documentation provided and I feel I have understood the
basics of the Object model used by TC. However , I am still a bit confused
about the usage of DOM or TreeView model for the objects. I do understand that
Treeview model is faster and I can also feel that the test execution is quite
slow as I am using DOM model. I am writing down the reason I thought of using
DOM model and if someone can show me how to do the same using Treeview model
then it will be really helpful


 When I use TreeView model the object is
recorded as follows


Call Aliases.IEXPLORE. pageSearchResultsCom.formAspnetform.panelFc.panelContent.panelBodyContainer.panelBodyContainerBody.panelFullwidth.panelCtl00Cp1Pnlf1home.panelSearchClear.panelSearch.panelFcContentClear.panelClear.panelSearch1.textboxCtl00Cp1
ucSearchPanel3SmartSearchTxt.SetText("london")


 And when I use DOM mode it is recorded as


 Call Aliases.iexplore.pageSearchResultsCom.document.all.Item("ctl00_cp1_ucSearchPanel3_txtSmartSearch").SetText("Paris")



As you can see the Treeview model gives me a long physical name to handle with
whereas the DOM model gives a short name(for the obvious reason that there is
no hierarchy). But with the DOM model I can create an alias and reduce the name
to below


 Aliases.InternetExplorer.MainPage.ObjectBrowser.SearchText.SetText("London")


 Is there some way to reduce the physical
name of the object using Treeview Model to such a small line?


 Any help will be greatly
appreciated as I am really struggling here to get this workingL


 Thanks,


Shiv

8 Replies

  • shivashish's avatar
    shivashish
    Occasional Contributor

    Thanks for your help Robert. However ,TC did not automatically generate the aliases I had do this manually by using the name mapping feature.Is there some setting using which TC can generate it automatically ?





    Also ,when I create the Alias for the tree view model ,will I be able to use a short name like I did for DOM model .to be more precise ,can I create just one alias for all the frames and panels together ?an example in this case will be really helpfull .or even some standard structure to follow while mapping might also help





    In the DOM model ,there is a one to one mapping between the different hierarchies and the names used in the example given





    Thanks in advance for your help.





    Shiv
  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor
    Is there some setting using which TC can generate it automatically ?




    Under Tools | Options | Engines | NameMapping there is an option labeled "Map object names automatically".  If that's turned on, as you record tests, TestComplete will create the name mapping for you.



    Also ,when I create the Alias for the tree view model ,will I be able to use a short name like I did for DOM model .to be more precise ,can I create just one alias for all the frames and panels together ?
     



    The short answer to this is "Yes".  





    The long answer: The hierarchy that you pointed out that is generated for the tree view is the exact hierarchy from the browser through the page to the target component with all panels and tables underneath.  Most of that hierarchy is "noise" generated by the HTML components and such that are used in developing the page.  And it is all stored in the NameMapping panel and, by default, then stored in the Aliases panel.  What you'll need to do is edit it in the Aliases panel where you can rename things as much as you want.  For that matter, you can "collapse" that tree in the aliases.  So long as the NameMapping is left as it is, the alias will be able to find the component.



    A good starting point for reading is at http://smartbear.com/support/viewarticle/12449/  This contains a lot of links to other articles describing how to modify NameMapping and Aliases.



    As for renaming specific items, check out http://smartbear.com/support/viewarticle/12478/

    As for editing the hierarchy (collapsing the "tree"), check out http://smartbear.com/support/viewarticle/12465/



    Does this help?
  • shivashish's avatar
    shivashish
    Occasional Contributor
    Thanks a ton Robert. This helps me greatly in taking my framework further



    I will go through the links and give it a try tomorrow itself .thanks again for your help and support 
  • shivashish's avatar
    shivashish
    Occasional Contributor

    Hi Robert,


     I tried playing around with the TreeView model after reading
    the links suggested by you and I am now stuck at the following place


     I mapped the objects in rge NameMapping screen and I pressed
    Skip for the panels which I did not want to named in the Alias. I got the Alais
    as shown in figure 1 of the attached document. The Aliases were already
    populated in the Aliases window(I was of the idea that I was supposed to drag
    the specific alais that I need to use)


     I called the Alias by using the below line  to test it in a script


    Aliases.IEXPLORE.HomePage.SearchText.type("London > United
    Kingdom")


    But when I started running the test, I got the following
    screen(Update Name Mapping, screenshot attached) where TC said that it could
    not find the object in the hierarchy


     Is there something wrong that I am doing in the name mapping.
    Please let me know if the question is not very clear to you


    My whole objective is that the full name of the object


    Aliases.IEXPLORE.
    pageSearchResultsCom.formAspnetform.panelFc.panelContent.panelBodyContainer.panelBodyContainerBody.panelFullwidth.panelCtl00Cp1Pnlf1home.panelSearchClear.panelSearch.panelFcContentClear.panelClear.panelSearch1.textboxCtl00Cp1
    ucSearchPanel3SmartSearchTxt.SetText("london")


    should be replaces by a short name like



    Alias. HomePage.SearchPage.SearchText.type("London > United
    Kingdom")

    Thanks,


    Shiv

  • shivashish's avatar
    shivashish
    Occasional Contributor
    Thanks for the link Robert. This is really detailed



    IT has already helped me solve a few queries. However, if i get stuck with anything then i will again bother you



    Thanks again for your timely help