cancel
Showing results for 
Search instead for 
Did you mean: 

How to record dynamic object name- Keyword Test

SOLVED
New Contributor

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 Smiley Happy 

 

Thank you in advance

Yagmur

 

1 ACCEPTED SOLUTION

Accepted Solutions
Staff

Re: How to record dynamic object name- Keyword Test

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. 

View solution in original post

7 REPLIES 7
Community Hero

Re: How to record dynamic object name- Keyword Test

We need to get a little technical here but I promise not a lot   Smiley Happy

 

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.  

 

Highlighted
Staff

Re: How to record dynamic object name- Keyword Test

And here is another video describing the use of wildcards (*) with dynamic object name-mapping

https://support.smartbear.com/screencasts/testcomplete/reliable-tests-for-dynamic-objects/

New Contributor

Re: How to record dynamic object name- Keyword Test

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?

 

 

 

Community Hero

Re: How to record dynamic object name- Keyword Test

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.

Community Manager

Re: How to record dynamic object name- Keyword Test

Thank you everyone for looking into this. 

Hi @Yagmur , could you provide us with a sample project that shows the issue? Then it will be easier for the community to try providing you with a solution! Thank you. 



Sonya Mihaljova
Community and Education Specialist

 Join SmartBear Connect next April in Boston to meet with software development, API and testing experts from around the world! Get your ticket today!
New Contributor

Re: How to record dynamic object name- Keyword Test

I am using Keyword Test, since I dont know any script language. That's why there is no code. 

I need to find a way how to uniquely identify the object containing the option that is dragged.

These options have dynamic properties, and therefore I cannot capture the same object at every run of our automated test.

I followed the below steps:

1. Dragging option 2:

Dragged option2.png

2. After running few times, received an error message which says 'the object does not exist'

3. Go to the Name Mapping and click on Edit of the recorded object. The screenshot below shows that I need to update my object, even though it was working properly before:

2019-12-19_10-40-34.png

 

4. Once I update the properties by clicking on 'update', the recorded object highlights the option 3 instead of option 2.

2019-12-19_10-41-57.png

 

I’ve tried one possible solution which is updating the dynamic parts of the properties by using wildcards:

a) updating 'contentText, innerText and outerText'  by adding *or ?

b) updating outerHTML " <span data-am-translate="Question14.Draggable.2" data-am-translate-group="Question 14" data-wysiwyg="false">2</span> "  by changing the dynamic parts with ? ==> <span data-am-translate="Question14.Draggable.?" data-am-translate-group="Question 14" data-wysiwyg="false">?</span>

 

However, using wildcards didnt help.

 

 

 

Staff

Re: How to record dynamic object name- Keyword Test

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. 

View solution in original post