Ask a Question

Required Parent with a mapped object

kmorillo
Occasional Contributor

Required Parent with a mapped object

Is it possible to have a mapped object require parent? We have dynamic pages and want to ensure mapped objects are unique to a page.

 

Issue Example: The parent page object is defined using a URL plus required child of specific text on page. Then manually added children from that page. The issue is that the children objects are found on any page without limiting the criteria that defines the parent.

9 REPLIES 9
Marsha_R
Community Hero

Unless it's top level on the page, a mapped object will always have a parent

 

Can you give us a more specific example?  


Marsha_R
[Community Hero]
____
[Community Heroes] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Heroes]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Hero] signature is used with permission by SmartBear Software.
https://community.smartbear.com/t5/custom/page/page-id/hall-of-fame
Bobik
Frequent Contributor

Could you share your name mapping file? 


kmorillo
Occasional Contributor

First, thank you all for your patience and feedback, we really appreciate it. 

 

Attached you will find a screenshot of the object in the brower and its respective mappling.  

 

Thank you again .... 

pageRtsDiabInsulin.preg_ChangesettingsLink and pageRtsDiabPreg.preg_ChangesettingsLink will give you the two different buttons

 

If you're looking for a shorter path to each button, consider Aliases (see the section on this page)

https://support.smartbear.com/testcomplete/docs/testing-with/object-identification/name-mapping/abou...

 

You could have an alias InsulinSettings for the first one and PregSettings for the second one and use those instead of the full mapped name.


Marsha_R
[Community Hero]
____
[Community Heroes] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Heroes]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Hero] signature is used with permission by SmartBear Software.
https://community.smartbear.com/t5/custom/page/page-id/hall-of-fame

What are the identification properties of the two different pages? Does the URL actually change between the two? 


Thanks,
Carson

Click the Accept as Solution button if my answer has helped
kmorillo
Occasional Contributor

The URL is identical except for an id which gets created at runtime. The page which loads however includes text which uniquely identifies a specific page and that’s what we are using as a “Required Child”. Then I map other objects for a specific page in the MappedObjects. The issue is the object under the page does not account for the parent page as criteria to recognize the child object. It may find it on some other page having the matching properties for that node only. This lead us to our post asking “Required Parent with a mapped object”. Is there a way?

You can build a string that is the whole path of the required child, starting with the parent page, then adding in the id, then adding the desired object name on the end.  Then use eval(MyString) as the object to search for.  That will give you the specific object on the specific page.


Marsha_R
[Community Hero]
____
[Community Heroes] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Heroes]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Hero] signature is used with permission by SmartBear Software.
https://community.smartbear.com/t5/custom/page/page-id/hall-of-fame
kmorillo
Occasional Contributor

Marsha, 

 

We appreciate the suggestions how to rememdy via a script. The orginal question was if we could do it via name mapping. 

 

Can we do it via mapping or do we have to script?  If via mapping, how is that done?

You can't "require" anything in a name mapping.  It's a tree construct that shows how your objects relate to each other.

 

If you have objects that have similar names in the mapping, then you can use the Alias feature as I mentioned before to give them unique names and use those names in your test instead of the mapped names. 

 

If you don't want to use Aliases, then you can construct the specific name each time as I suggested and then you will access exactly that object and not a similar one on another page.


Marsha_R
[Community Hero]
____
[Community Heroes] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Heroes]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Hero] signature is used with permission by SmartBear Software.
https://community.smartbear.com/t5/custom/page/page-id/hall-of-fame
cancel
Showing results for 
Search instead for 
Did you mean: