Forum Discussion

Yagmur's avatar
Yagmur
New Contributor
6 years ago

How to record dynamic object name- Keyword Test

Hi,

I'm testing a booklet for an achievement test which has two parts and these parts contain 'Drag and Drop' question type. 

When I record a test of 'Drag and Drop' for Part1, everything is running perfectly. However, the same objects cannot be applied to 'Drag and Drop' of Part2. As soon as I record a new test for  Part2, I get new objects and the previous ones do not work for Part1 anymore. 

For example for the first dragged item:

Part1: Aliases.browser.pageAssessmentMasterEngineLms.frameContentFrame.textnode2 

Part2: Aliases.browser.pageAssessmentMasterEngineLms.frameContentFrame.textnode32

 

The questions are like multiple choice. Except the content, the logic is the same.  

I am not an IT person and an advanced user in TestComplete. Therefore, I would be glad if someone could help me with non-technical terms :) 

 

Thank you in advance

Yagmur

 

  • So it seems like the mapping settings for that textnode contains redundancies to begin with, since contenttext, innertext, and outertext, are all the same. Before trying to wild card (*) out any of those identification settings, have you tried to look for any object properties that are static and unique that you might be able to use? (other than the properties that contain the dynamically generated numbers)

    Also when you update the outerHTML property, i believe that you should use the * instead of ? such that :

    <span data-am-translate="Question14.Draggable.*" data-am-translate-group="Question 14" data-wysiwyg="false">*</span>

    but this may lead to some ambiguous recognition errors, if there are additional textnodes in that drag and drop portion of the applications that also fall into that mapping setting. 

  • We need to get a little technical here but I promise not a lot   :)

     

    https://support.smartbear.com/testcomplete/docs/reference/misc/using-wildcards.html

     

    If you want the same test to work in Part 1 and Part 2, you will need to use something like this in your test

    Aliases.browser.pageAssessmentMasterEngineLms.frameContentFrame.textnode*

     

    The asterisk means that anything  that looks like textnode, whether it's textnode2 or textnode32 or textnode9999999999999999999999999999999999999999, will match your test. 

     

    The link I posted above about Using Wildcards will explain more.  

     

    • Yagmur's avatar
      Yagmur
      New Contributor

      Hi Marsha and hkim5,

      Thank you for your reply.

      I have tried this method before and unfortunately didnt help me to solve the issue. 

      Intelligent Fix is suggesting to put asteriks. However, after I update my object (let say 1.option)  with  *, for instance contentText which Intelligent Fix is suggesting me, 2., 3. or 4. option is being selected/dragged instead of 1. option. Updating the object is not helping me,since this is a repetitive problem. So, everytime I need to update the object (contentText). 

      In addition, I found out today that If I record only Part1 and run it few times, I encounter the same problem. (The object doesnt exist). 

      Is there any different approach to solve this problem?

       

       

       

      • Marsha_R's avatar
        Marsha_R
        Moderator

        Having to guess what's going on is very frustrating, so we're going to need more details from you.

         

        We need to see your actual code, we need to know what things you have tried to solve the problem, and what happened when you tried those things.  Seeing "oh no I tried that already" is not helpful for us or you.  We can get you an answer much quicker with complete information.