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.
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)
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.
What are the identification properties of the two different pages? Does the URL actually change between the two?
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.
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.