Forum Discussion

swathi's avatar
swathi
New Contributor
14 years ago

How to handle dynamic object IDs using TestComplete

Hi,

I have an issue. We use an application called Clarity


i was not able to proceed using the tool with the application due to the dynamic object IDs that are present in the application.


The snippet is as below:


“Call table.cell.textboxD18284e6.SetText("loginID")


  Call table.cell2.passwordboxD18284e8.SetText("pwd")



The value in bold above is the dynamic value for the textbox field which recognizes the text box field at run time. Now, I wish to replace this value with some other field identifier; this is the field id, how will I be able to replace with the field name instead?


Or, can I use a regular expression for this field, give that expression a name and replace the occurrence of the dynamic value with the regular expression name? if so, how can I implement it in TestComplete?


OR, is there any other method to solve this issue?


could anyone suggest?



Thanks in advance

7 Replies


  • Hi Swathi,





    Double-click the 'NameMapping' item in the Project Explorer panel - this will open the Name Mapping editor. Locate and select the 'textboxD18284e6' object either in the 'Aliases' tree or in the 'Mapped Objects' tree. To the right, you'll see the identification properties and values TC used to map the object. You should see the 'ObjectIdentifier' property which has the 'D18284e6' value. Replace the value with '*' (without quotation marks). See Specifying Identification Property Values for more information.





    Do the same for the 'passwordboxD18284e8' object. This will allow you to use these objects no matter what IDs are.
  • Hi Swathi,


    for example, a text box which takes resource name ( it has an ID now and an entry in the name mapping). after all other steps, i come back to the same page, and enter the same resource name in the text field, but now, the text box mapped in the name mapping is different( i mean there is another entry).



    The fact that another mapped name was created for the same object of the application means that the value of one or several object properties (they are called identification properties) which were used to map this object had changed. Despite the fact that you're working with the same actual object, TC treats it as another object as it has other property values.


    To overcome this, you need to analyze how the values of the identification properties change and then exclude the varying part from the identification property's value. For example, one time, one of the object property has the 'value123' value, the second time, it will be 'value345'. So, you need to set the value of the identification property to 'value*'. When you're interacting with that object, TC won't create a new mapped object when the actual property's value changes to 'value345'.


    I recommend that you read the 'Name Mapping - Overview' help topic to learn how the Name Mapping feature works.

  • swathi's avatar
    swathi
    New Contributor
    Hello David,



    Thank you for the suggestion. The issue is solved now.

    but,

    there are several textfields in the application. for example, a text box which takes resource name ( it has an ID now and an entry in the name mapping). after all other steps, i come back to the same page, and enter the same resource name in the text field, but now, the text box mapped in the name mapping is different( i mean there is another entry).



    I agree, the value for the text field id changes, but why there are 2 entries for the same text field? if i use the same old text field name in the script, it doesnot work.



    thanks in advance
  • ashok_natar's avatar
    ashok_natar
    Occasional Contributor
    Hi All, 



    I have an issues where, the identification properties are completely getting changed!! 



    something below! 


    Panel(3). 



    Even i have tried with 

    Panel(*) but no luck!!! 



    Could you please tell me how do we manage this!!

    • hogueybear's avatar
      hogueybear
      Occasional Contributor

      The video is good, but I don't have access to youtube at work (security) and I don't have the codecs to run the downloaded version (security again), so I have to watch it at home, come into work and try to remembe what it said from my sketchy notes.

       

      Any chance you could host it directly on your site?