cancel
Showing results for 
Search instead for 
Did you mean: 

Required Parent with a mapped object

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
Community Hero

Re: Required Parent with a mapped object

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

 

Can you give us a more specific example?  

Contributor

Re: Required Parent with a mapped object

Could you share your name mapping file? 


Occasional Contributor

Re: Required Parent with a mapped object

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 .... 

Community Hero

Re: Required Parent with a mapped object

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.

Community Hero

Re: Required Parent with a mapped object

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
Occasional Contributor

Re: Required Parent with a mapped object

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?

Community Hero

Re: Required Parent with a mapped object

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.

Occasional Contributor

Re: Required Parent with a mapped object

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?

Community Hero

Re: Required Parent with a mapped object

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.

Top Kudoed Authors