Forum Discussion

testbogus's avatar
testbogus
Occasional Contributor
3 years ago

How to record dynamic objects

Hello!
This is a situation where an object needs to specify a value that keeps changing dynamically. For example, in the case of adding a table list, the attribute value will be different each time a table is added. It seems that div / div / div / div / td / td / td / td cannot be recognized if it is in this format by name mapping, and it is recognized if div [4] td [4] is in this format. is.
This phenomenon is so frequent that you cannot control everything. Do you have the know-how to record in such cases?

  • Hi testbogus 

     

    I hope you are keeping well.

     

    In TestComplete, you can define rules for detecting and handling dynamic identifiers in web applications. For example, you can configure TestComplete to ignore IDs that match a specific pattern or instruct it to extract and use the stable part of dynamic IDs.

     

    There are options for Ignoring Dynamic IDs and Extracting Stable IDs From Dynamic IDs. 

     

    Examples of which can be found in the following documentation; 

     

    https://support.smartbear.com/testcomplete/docs/app-testing/web/general/common-tasks/dynamic-identifiers.html

     

    Please let me know if this resolves your query or if you have any additional questions.

     

    Thanks,

    Shane

    • testbogus's avatar
      testbogus
      Occasional Contributor

      SBegley 

      Thank you for your help.

      The attribute value of namemapping keeps changing dynamically and

      I tried to display the above document but it failed.
      Can you tell me how?

       

      • AlexKaras's avatar
        AlexKaras
        Champion Level 3

        Hi,

         

        For obvious reason dynamic property values cannot be used for object search and/or mapping.

        You must either resort to the use of properties that have unique and stable identifiers or exclude dynamic part of property value.

        To illustrate the latter: assuming there is a button that have no other meaningful identifying properties but ObjectIdentifier and contentText where the latter property has dynamic value of 'Continue with XX items in a cart'. To map such button you may try something like this:

        ObjectIdentifier == 'Button'

        contentText == 'Continue with * items in a cart'